Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Binding event handlers in jquery
Play lesson

jQuery tutorial for beginners - Binding event handlers in jquery

5.0 (2)
25 learners

What you'll learn

This course includes

  • 22.5 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

Link for all dot net and sql server video tutorial playlists https://www.youtube.com/user/kudvenkat/playlists?sort=dd&view=1 Link for slides, code samples and text version of the video http://csharp-video-tutorials.blogspot.com/2015/04/binding-event-handlers-in-jquery.html Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help. https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation=1 In this video we will discuss binding event handlers to events using bind() method in jQuery One way to bind event handlers to events is by using the jQuery shorthand functions like .click, .mouseover etc. Bind method is another way of doing the same. The following example binds click event handler to the button - btnClickMe $('#btnClickMe').bind('click', function () { $('#divResult').html('Button Clicked'); }); Binds multiple event handlers to the button - btnClickMe. If required, the event object can also be passed to the event handler method, although it is optional. $('#btnClickMe').bind('click mouseover mouseout', function (event) { if (event.type == 'click') { $('#divResult').html('Button Clicked at ' + 'X = ' + event.pageX + ' Y = ' + event.pageY); } else if (event.type == 'mouseover') { $(this).addClass('ButtonStyle'); } else { $(this).removeClass('ButtonStyle'); } }); Use the unbind() method to unbind the event handler $('#btnClickMe').unbind('mouseover'); To unbind all the event handlers of an element, use unbind() method without any parameters $('#btnClickMe').unbind() Please note: If you are using jQuery 1.7 or higher, you should be using on() and off() methods instead of bind() and unbind() methods. We will discuss on() and off() methods in our next video.

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere