php - Enable/ disable button when a div collapse -


i have code collapsing using bootstrap :

<a href="javascript:void(0)" data-toggle="collapse" data-target="#foo">edit</a>  <div id="foo" class="collapse"> text. </div>  <button type="button" class="continue">continue</button> 

how make continue button enable when foois collapse out, , dissable when foo collapse in?

according official documentation, collapse plugin in bootstrap fires several events can hook onto.

the ones interested in shown.bs.collapse , hidden.bs.collapse. fire when either foo collapsed out or collapsed in respectively.

now have hook onto events.

$('#foo').on('hidden.bs.collapse', function () {     $('.continue').attr('disabled', 'disabled'); });  $('#foo').on('shown.bs.collapse', function () {     $('.continue').removeattr('disabled'); }); 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -