I can’t seem to get removeAttr
to work, I’m using the example I saw on the jQuery site. Basically onclick
I add the attribute to disable a field (which works just fine) but when the user clicks again it should enable the field in question. I used alerts to make sure the else block is being fired, so I know that’s not it.
Code:
JavaScript
x
11
11
1
$('#WindowOpen').click(function (event) {
2
event.preventDefault();
3
$('#forgot_pw').slideToggle(600);
4
5
if('#forgot_pw') {
6
$('#login_uname, #login_pass').attr('disabled','disabled');
7
} else {
8
$('#login_uname, #login_pass').removeAttr('disabled');
9
}
10
});
11
Thanks.
Advertisement
Answer
All good used this:
JavaScript
1
10
10
1
$('#WindowOpen').toggle(
2
function()
3
{
4
$('#login_uname, #login_pass').attr("disabled","disabled");
5
},
6
function()
7
{
8
$('#login_uname, #login_pass').removeAttr("disabled");
9
});
10