Habilitar deshabilitar jquery script onclick evento

I have table with td onclick event

<td id="ab2" onclick="popup('test')">Link</td>

I have disable onclick by calling

 $(#ab2").prop("onclick", null); 

Now i want to enable this link again when some one clicks on enable link below

<a href="#">Enable</a>

Muchas Gracias

preguntado el 27 de noviembre de 13 a las 07:11

What are you trying to do?? -

@ Milind Anantwar onbody onload i have disable onclick now again one more link is there enable if anybody clicks on it onclick event will get enabled -

2 Respuestas

Utilizar este..

$("#ab2").unbind("click");

$( "#ab2" ).bind( "click", function() {
  alert( "User clicked" );
});

respondido 27 nov., 13:07

utilizan el on y off in jQuery they work for it

para habilitar

$(#ab2").on("click"); 

for disble

$(#ab2").off("click"); 

respondido 27 nov., 13:07

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.