Closed biancashouse closed 9 years ago
Pass the selector as the second parameter of on()
El dom, 9 de noviembre de 2014 09:02, Bianca Cat notifications@github.com escribió:
live() is deprecated, but I still have to use it...
E.g
public void listenForProgramClicks() { GQuery q = $("#programs-panel >.panel-body button"); //SELECTORS.qAnyProgramButton(); q.on("click", new Function() { public boolean f(Event e) { GQuery qClickedEl = $(e); String programId = qClickedEl.attr("program-id"); TrainingProgramDemo.programClicked(programId); return true; } }); }
does not work, but this does:
public void listenForProgramClicks() { GQuery q = $("#programs-panel >.panel-body button"); //SELECTORS.qAnyProgramButton(); q.live("click", new Function() { public boolean f(Event e) { GQuery qClickedEl = $(e); String programId = qClickedEl.attr("program-id"); TrainingProgramDemo.programClicked(programId); return true; } }); }
If I am not using on correctly, I apologise in advance ;-)
Thanks
— Reply to this email directly or view it on GitHub https://github.com/ArcBees/gwtquery/issues/306.
Manuel,
I found this SO page, where answer 4 explains why we should use the delegated version of on(). Now I get it.
http://stackoverflow.com/questions/8110934/direct-vs-delegated-jquery-on
Many thanks
Ian
On Sun, Nov 9, 2014 at 7:50 PM, Manuel Carrasco Moñino < notifications@github.com> wrote:
Pass the selector as the second parameter of on()
El dom, 9 de noviembre de 2014 09:02, Bianca Cat notifications@github.com
escribió:
live() is deprecated, but I still have to use it...
E.g
public void listenForProgramClicks() { GQuery q = $("#programs-panel >.panel-body button"); //SELECTORS.qAnyProgramButton(); q.on("click", new Function() { public boolean f(Event e) { GQuery qClickedEl = $(e); String programId = qClickedEl.attr("program-id"); TrainingProgramDemo.programClicked(programId); return true; } }); }
does not work, but this does:
public void listenForProgramClicks() { GQuery q = $("#programs-panel >.panel-body button"); //SELECTORS.qAnyProgramButton(); q.live("click", new Function() { public boolean f(Event e) { GQuery qClickedEl = $(e); String programId = qClickedEl.attr("program-id"); TrainingProgramDemo.programClicked(programId); return true; } }); }
If I am not using on correctly, I apologise in advance ;-)
Thanks
— Reply to this email directly or view it on GitHub https://github.com/ArcBees/gwtquery/issues/306.
— Reply to this email directly or view it on GitHub https://github.com/ArcBees/gwtquery/issues/306#issuecomment-62296224.
Ian White h: +61 2 9948 9739 m: +61 404 950 122 skype (home): biancashouse
Nice reference! +1
live() is deprecated, but I still have to use it...
E.g
does not work, but this does:
If I am not using on correctly, I apologise in advance ;-)
Thanks