在写网页程序时可以通过jquery中的attr()函数修改设置按钮等表单控件的disable属性 让按钮禁用或者让按钮从禁用改为启用,
$(’#button’).attr(’disabled’,"true");添加disabled属性
$(’#button’).removeattr("disabled"); 移除disabled属性
在html标签中设置按钮被禁用,可以使用如下代码
<input type=’button’ id=’test’ value=’disabled’>
在jquery中可以使用attr()函数修改按钮的disable属性
$(“#test”).attr(‘disabled’,false);
看一款完整实例代码
<!doctype html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.4.4.js"></script>
</head>
<body>
<form action="index.asp">
<input name="email" disabled="disabled" />
<input name="id" />
<input name="修改按钮的disable属性" type=’submit’ id=’test’ value="修改按钮的disable属性" >
在jquery中可以使用attr()函数修改按钮的disable属性
</form>
<script>$("input:disabled").val("this is it");
$("input:disabled").attr(’disabled’,true);
$("#test").attr(’disabled’,true);
</script>
</body>
</html>
上海专业网页设计公司上联网络原为你企业信息化帮你精心设计你公司的网页http://www.web258.cn