button
<button type="button" class="btn" onclick="CountClass()" runat="server" data-toggle="modal" data-target="#inlineForm1">OPEN</button>
modal
<div class="modal fade text-left" id="inlineForm1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel34" aria-hidden="true">
some code
</div>
JavaScript:
function CountClass() {
if(some code){
$('#inlineForm1').modal('hide');
}
}
why is not it working??
$(document).ready(function(){
$('.modal').modal('hide');
});
You didn't say what your if expression needs to be, so I'm not addressing that, but to hide something with jQuery you can just use .hide() on the element you select.
$('#inlineForm1').hide();
Behind the scenes, this adds style="display:none" to the element, and the opposite, .show() removes this. Knowing this, you can also override the behavior with CSS or start it in one state or the other.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With