Click here to Skip to main content
16,019,107 members

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
 
You can do this way too,
JavaScript
$("#home").click(function(){ alert("works"); })

or

JavaScript
$("#home").on("click", function(){ alert("works"); })
 
Share this answer
 
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

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