Print Shortlink

.on() in jQuery and Sencha

jQuery and Ext JS4/Sencha Touch are getting increasingly similar by the day.
jQuery 1.7 has introduced a new function .on() for handling events which is similar to the on() of Sencha Touch.
Say you have a button with id “loginBtn“, you can handle the click event as given below.

$("#loginBtn").on("click",function(){
	//Your goes code goes here
});

Now compare the same with Sencha Touch. You can handle the tap event as given below.

Ext.getCmp("loginBtn").on("tap",function(){
	//Your code goes here
});

Extremely interesting for developers who work with both!!!

Page 1 of 1

2 Responses

  1. A.Gnanasuriyan

    Yes, I have also noticed that . The following link helps me to get some more information about on(), bind(), delegate() and live() methods present in JQuery.
    http://www.elijahmanor.com/2012/02/differences-between-jquery-bind-vs-live.html

  2. Badri Narayan

    Good article. Learnt something new. Thanks

Leave a Reply