jquery中禁用(disabled)dom元素
I have a wired behaviour when I try todisable or readonly a input field using the attr().
removeAttr('disabled') is working ok. – 使用removeAttr()移除“disabled”属性即可 ~
attr('name', 'somthing') is working
attr('id', 'something else') is working
attr('disabled','disabled') not working-> it writes only disabled="" in the DOM and it does not disablethe input field
attr('readonly','readonly') not working-> it writes only readonly="" in the DOM but the input field canstill be edited.
例子:
$(document).ready(function() {
$("input[name='rdio']").live('click', function() {
$(".radio_select").find("input[name='rdio']").each(function(){
if(this.checked)
{
$("#"+this.value).removeAttr('disabled');
}
else
{
$("#"+this.value).attr('disabled','disabled');
}
});
});
});