2015-04-06 70 views
0

我有元素,通過UI框架生成如下:如何通過JQuery修改樣式屬性?

<div id="GENERATED_CONTAINER" style="position: fixed; z-index: 100; left: 368px; top: 52px; width: 545px; height: 846px;"> 
    <div id="GENERATED_CONTENT style="opacity: 0.1; left: 5px; top: 5px; bottom: -5px; width: 545px; height: 846px;"> 
    </div> 
</div> 

我需要編寫一個腳本,是從樣式屬性除去widthheight

var elems = $("[id^='GENERATED_']"); 
//what should I apply now? 

回答

2

簡單地寫.css

$("[id^='GENERATED_']").css({ 
    width: 'inherit', //or the value 
    height: 'inherit' //or the value 
}) 
1
$("[id^='GENERATED_']").css({width:0px,height:0px}) 
1

您可以清除使用添加,並通過去除jQuery.css().css()

的內嵌樣式Here's a fiddle內聯樣式。

相關問題