selector #id, click on a button, the element with id="test" will be hidden
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
$("button").click(function () {
$("#test").hide();
});
});
</script>
</html>
<body>
<h2>This is a heading</h2>
<p>This is a paragraph</p>
<p id="test">This is a another paragraph</p>
<button>Click me</button>
</body>
Comments
Post a Comment