Click here to Skip to main content
15,887,746 members

Check the jQuery on method[^] documentation, especially the Direct and delegated events section.
Your new jQuery code should look something like this:
JavaScript
$('#alertMessage').on('click', '#home', function () { ... })
 
Share this answer
 
v2
You can do this way too,
JavaScript
$("#home").click(function(){ alert("works"); })

or

JavaScript
$("#home").on("click", function(){ alert("works"); })
 
Share this answer
 
Try below..
JavaScript
$(document).ready(function()
    {
         $("#home").click( function () {alert("WOrking");});
     });


Or

C#
$(document).ready(function()
    {
         $("#home").click( function () { myfunction() });
     });
     function myfunction()
     {
        alert("WOrking");
     }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900