I am a beginner in HTML. How would I make a button that would hide itself when clicked using JavaScript? This is the code I have already, missing a line.
<!DOCTYPE>
<html>
<body>
<button type="button" onclick="delete()" = ;>Hello</button>
<script>
var delete = function(){
//hide button
}
</script>
</body>
</html>
delete is a keyword in js. Use a different name
onclick="deleteThis(this)"
var deleteThis = function(elem){
elem.style.display = 'none';
// elem.style.visibility = 'hidden';
};
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