//两种方法设置disabled属性
$('#areaSelect').attr("disabled",true)
$('#areaSelect').attr("disabled","disabled")
以下三种方法是移除(去除)掉input的disabled属性的方法:
//三种方法移除disabled属性
$('#areaSelect').attr("disabled",false)
$('#areaSelect').removeAttr("disabled")
$('#areaSelect').attr("disabled","")
将style中你想删掉的属性设为null应该是可以解决的,Chrome通过例如:
elem.style["height"] = null//彻底删除elem的style属性的height值
<!DOCTYPE HTML><html>
<head>
<meta charset="UTF-8" />
<title>last.html</title>
<style>
</style>
<script type="text/javascript">
var change = function ()
{
var a = document.getElementById ('a')
a.value = 'apple'
for ( var i = 0 i < a.children.length i++)
{
var ac = a.children[i]
if (!!ac.getAttribute ('selected'))
{
ac.removeAttribute ('selected')
}
if (ac.value == 'apple')
{
ac.setAttribute ('selected', 'selected')
}
}
}
</script>
</head>
<body>
<select id="a">
<option value="apple">苹果</option>
<option value="orange" selected="selected">橘子</option>
<option value="pear">雪梨</option>
</select>
<input type="button" onclick="change()" value="change" />
</body>
</html>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)