user7789076
user7789076

Reputation: 798

Enable disable jquery script onclick event

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>

Thanks

Upvotes: 0

Views: 1058

Answers (2)

Rituraj ratan
Rituraj ratan

Reputation: 10378

use on and off in jQuery they work for it

for enable

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

for disble

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

Upvotes: 1

Shashank
Shashank

Reputation: 829

Use this..

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

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

Upvotes: 1

Related Questions