How to Bind an Event with an Element using JQuery


You have an element (link, button etc.) on page and you want to bind any particular event (click, mouseover etc.) with it using JQuery. You can use JQuery bind method for this purpose.

A simple link element

<a href="#" id="HelloLink">Hello</a>

JQuery bind method to bind a click event with the above element

$("#HelloLink").bind('click', function() 
{ 
   alert('Hello'); 
});

 

 

About author


User avatar

Waqas Anwar

Founder of EzzyLearning.com, Senior Consultant, Microsoft .NET and Web Technologies

Comments