HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <style> .point{ color: red; font-size: 22px; } </style> </head> <body> <h1>jQuery hasClass() Method</h1> <p class="point">Click on the button to check whether this paragraph has 'point' class.</p> <button>Click Me</button> <script> $(document).ready(function(){ $("button").click(function(){ alert($("p").hasClass("point")); }); }); </script> </body> </html>
OUTPUT
×

Save as Private