Page 1 of 1

Unbind onclick event

Posted: Tue Sep 09, 2014 11:16 am
by Manuel Menéndez Román

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


Unbind onclick event

Posted: Tue Sep 09, 2014 2:43 pm
by Kateryna Grynko

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

Unbind onclick event

Posted: Tue Sep 09, 2014 3:07 pm
by Manuel Menéndez Román

Perfect!
Thanks