To bind event to an element using jQuery is very easy task.
See the following examples,

$('#foo').bind('click', function() {
      // other stuff
});

You can also call external function like below,

function clickEvent()
{
    alert('Clicked');
}  

$('#foo').bind('click', clickEvent);

Another way to bind event,

$('#foo').click(clickEvent);

or you can write inline function like below,

$('#foo').click(function(){
    alert('Clicked');
});
Avatar for Multidots
Author : Multidots
Multidots is a one-stop solution provider for Enterprise WordPress, WooCommerce Development, Mobile Application, and Web Application development services. We help you build a unique digital experience and guide you to the best technology for your business, whether you're a large-scale enterprise or are just getting started.

Comments

Leave a Reply

How can we help you?

Submit your Business Enquiry here and we will get in touch shortly.

Contact Us