The JQuery on () method is a method of an officially recommended binding event that can also bind events for future elements
$ (selector). On (Event,childselector,data,function,map)
Several of the previously common methods that have been extended are as follows.
bind () $ ("P"). Bind ("click", Function () {alert ("the paragraph was clicked."); }); $ ("P"). On ("click", Function () {alert ("the paragraph is clicked."); }); delegate () $ ("#div1"). On ("click", "P", function () {$ (this). CSS ("Background-color", "pink"); });
$ ("#div2"). Delegate ("P", "click", Function () {$ (this). CSS ("Background-color", "pink"); }); Live () $ ("#div1"). On ("click", Function () {$ (this). CSS ("Background-color", "pink"); });
$ ("#div2"). Live ("Click", Function () {$ (this). CSS ("Background-color", "pink"); });
$ (document). Ready (function () {$ ("P"). On ("click", Function () {$ (this). CSS ("Background-color", "pink"); }); $ ("button"). Click (function () { $ ("P"). Off ("click"); });});