disable / enable asp.net linkbutton using javascript
I need to be able to enable and disable a linkbutton using javascript as part of a custom validator that I'm writing.
I discovered that setting "disabled=true" will disable a standard button, but it does nothing to a linkbutton.
After mucking about in JQuery I discovered that the following will actually disable the button:
$(button).click( function() { return false; }
Where button is a reference to the object. That works well. However, I can't for the life of me work out how to re-enable it! Neither of these seem to work:
$(button).click( function() { return true; }
$(bu开发者_运维百科tton).click( function() { }
If anyone could either point me in the right direction to re-enable my button, or suggest a better way of disabling the button, It'd be appreciated.
Chers, Matt
I think you have to unbind the first event first.
Don't know in other versions, but in 1.4.2 you can attach multiple events, so the behaviour when you do this
$(button).click( function() { return false; }
$(button).click( function() { return true; }
will be 'return false;return true;'
$(button).unbind('click');
$(button).click( function() { return true; }
精彩评论