Senthil Kumar Bhaskaran
Senthil Kumar Bhaskaran

Reputation: 7451

Activate and Deactivate the Rails code hyperlink using JQuery

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' %>

Upvotes: 0

Views: 379

Answers (2)

ryanb
ryanb

Reputation: 16287

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

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

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

Upvotes: 1

Peter Hagstr&#246;m
Peter Hagstr&#246;m

Reputation: 108

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.

Upvotes: 1

Related Questions