.attr("disabled", "disabled") problem
Posted
by meo
on Stack Overflow
See other posts from Stack Overflow
or by meo
Published on 2010-06-09T10:17:33Z
Indexed on
2010/06/09
10:32 UTC
Read the original article
Hit count: 360
jQuery
i have this function where basically add and remove the disabled attribute form a input field:
$(bla).click(function(){
if (something) {
console.log($target.prev("input")) // gives out the right object
$target.toggleClass("open").prev("input").attr("disabled", "disabled");
}else{
$target.toggleClass("open").prev("input").removeAttr("disabled"); //this works
}
})
the removeAttr
works fine but when i need to add the disabled again it does just nothing. My console.log is triggering (and giving me back the right input field) so I'm sure my that my if statement works. But if i inspect the DOM with firebug the disabled attribute does not appear.
can someone help me?
PS: please don't focus on the function or the if statement itself, works fine its just that attr that dies not work for disabled...
© Stack Overflow or respective owner