Click on a <p> element to hide it. - Javascript jQuery

Javascript examples for jQuery:Mouse Event

Description

Click on a <p> element to hide it.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("p").click(function(){
        $(this).hide();//from www.java 2  s . c om
    });
});
</script>
</head>
<body>

<p>If you click on me, I will disappear.</p>

</body>
</html>

Related Tutorials