Manuel Menéndez Román
Posts: 0
Joined: Sat Jun 22, 2013 9:12 am

Unbind onclick event

Hello,
I have a config button in the header of my app. In inner pages I want to modify this same button to use it as a "go back" button.

The original onclick event (which shows the configuration page) was added through an appery event.

I've managed to change this button's icon and add a new onclick event using jquery, in specific pages.

But I've noticed now both events are being fired. So I need to unbind the original event.

I've tried using:
$( "#foo" ).unbind( "click" );

Or:
$( "#foo" ).off( "click" );

But none have worked. Both events are still being fired on click.

How would I do this?

Thank you

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Unbind onclick event

Hi Manuel,

Please see how you bind an event in page code, there should be something like this:
pre $('#Screen1_mobilecontainer [name="mobilebutton_6"]').die().live({
click: function() {
if (!$(this).attr('disabled')) {
alert("Hi");

Code: Select all

         } 
     } 
 });/preThat is, you should you the following code to unbind an event:pre$('#Screen1_mobilecontainer [name="mobilebutton_6"]').die("click");/pre
Manuel Menéndez Román
Posts: 0
Joined: Sat Jun 22, 2013 9:12 am

Unbind onclick event

Perfect!
Thanks

Return to “Issues”