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 foo
is 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.
$('#foo').on('hidden.bs.collapse', function () { $('.continue').attr('disabled', 'disabled'); }); $('#foo').on('shown.bs.collapse', function () { $('.continue').removeattr('disabled'); });
Comments
Post a Comment