Reputation: 325
Trying to hide a button on click using Bootstrap/JavaScript. Here is my button code:
<a href="#menu-toggle" class="btn btn-primary btn-lg" id="menu-toggle" onclick="hideBtn();">I understand</a>
Here is my script:
<script type="text/javascript">
function hidebtn(){
document.getElementById('menu-toggle').style.display = 'none';
}
</script>
It isn't working, any thoughts? Thanks!
Upvotes: 0
Views: 148
Reputation:
Try it with jQuery:
function hide(){
$( "#button" ).addClass( "hide" );
}
HTML & CSS:
<a id="#button" onClick="hide()">Button</a>
#button.hide {
display: none;
}
Upvotes: 1
Reputation: 2157
function hideBtn()
{
document.getElementById('menu-toggle').style.display = 'none';
}
<a href="#menu-toggle" class="btn btn-primary btn-lg" id="menu-toggle" onclick="hideBtn();">I understand</a>
Upvotes: 0