Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery Removing Clickable Behavior</title> <style> .menu a{ margin-left: 20px; } .menu a.disabled{ color: #666; text-decoration: none; } </style> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script> $(document).ready(function(){ $(".menu a").each(function(){ if($(this).hasClass("disabled")){ $(this).removeAttr("href"); } }); }); </script> </head> <body> <div class="menu"> <a href="https://www.tutorialrepublic.com/html-tutorial/">HTML</a> <a href="https://www.tutorialrepublic.com/css-tutorial/">CSS</a> <a href="https://www.tutorialrepublic.com/twitter-bootstrap-tutorial/">Bootstrap</a> <a href="https://www.tutorialrepublic.com/codelab.php" class="disabled">CodeLab</a> </div> <p><strong>Note:</strong> In this example we have removed the clickable behavior from links having the class "disabled".<p> </body> </html>