views:

188

answers:

2

How to activate and Deactivate the Rails code hyperlink using JQuery for the following code

<%= f.add_associated_link "Add another email address",:class => 'add' %>

please suggest me to solve this major problem
+1  A: 

Well, I you want to deactivate you could do something like

var activated = false;
$(".className").click(function(e){
 if(!activated){
   e.preventDefault();
 }
}

But you might wanna be a bit more specific about what you want to do.

Peter Hagström
I have tried with this part of coding but to my unluck it is not working please suggest other
Senthil Kumar Bhaskaran
+1  A: 

Do you want to hide/show the link? If so, you can use toggle.

$('a.add').toggle();

There's also hide() and show().

ryanb