如何移除元素的某个css属性

html-css010

如何移除元素的某个css属性,第1张

利用 removeAttribute方法

如:ele = document.getElementById('div1')

ele.removeAttribute('class')

初始化时动态加载隐藏。

jquery :

$(function(){

$("#id").show()显示

$("#id").hide()隐藏

})

js :

function init(){

document.getElementById("id").style.display = "block" 显示

document.getElementById("id").style.display = "none" 隐藏

}