保定网站建设,网站推广,网站优化服务,保定专业的PHP网站制作机构!

jQuery 删除标签的属性removeAttr(name)

发表于:2009年02月10日 11时  作者:dx_andy

jQuery删除标签的属性:动态控制文本标签的可读性时用到此操作:

jQuery 删除标签的属性removeAttr(name)示例代码:

<script type=”text/javascript”>
jQuery(function(){
if (jQuery(‘#Radio1′).attr(‘checked’)) {
jQuery(‘#RadioTitle’).removeAttr(‘readonly’);
} else {
jQuery(‘#RadioTitle’).attr(‘readonly’, ‘readonly’);
}
jQuery(‘#Radio0′).focus(function(){
jQuery(‘#RadioTitle’).attr(‘readonly’, ‘readonly’);
});
jQuery(‘#Radio1′).focus(function(){
jQuery(‘#RadioTitle’).removeAttr(‘readonly’);
});
});
</script>