views:

1211

answers:

3

There are 2 radiobutton and a hyperlink. if select 'radiobutton1' the hyperlink is enabled. if select 'radiobutton2' the hyperlink is disabled. i can use jquery to disable the hyperlink, but can't enable it. How to enable the hyperlink with jquery?

+2  A: 

You could try adding a click event handler and return true or false from the click handler based on the state of the radio buttons.

Returning false should cancel the click on the link, something like:

$("#hyperlink1").click(function(){          
 // return true or false based on your radio buttons  
 return enableLink;     
});
seanb
A: 

To disable hyperlink you could add onclick handler to it returning false;

something like this:

$("#radioDisable").click(function() {
    $(“hyperlink”).click(function(){
     return false;
    });
    $(“hyperlink”).addClass(“disabled”);
});

$("#radioEnable").click(function() {
    $(“hyperlink”).click(function(){
     return true;
    });
    $(“hyperlink”).removeClass(“disabled”);
});
miceuz
A: 

The 'disabled' property can be get and set. This property is for individual objects though and not for sets of objects.

if (!$("#ContinueButton")[0].disabled) {  
    UserContinue();  
}

write:

$("#ContinueButton")[0].disabled = !canContinue;
Frank Schwieterman