表Css屬性不對齊,如果我在jQuery中給CSS。 首先,我在這裏只給的Html動態表Css屬性使用jQuery
<tr id="trCustomLabel">
<td class="font12" style="border: 0px; width: 8%;padding-left: 10px;" id="tdlab">Custom Label</td>
<td class="font11" style="border: 0px; text-align: center; width: 2%;" id="tdlab1">:</td>
<td class="font12" style="border: 0px; padding-top: 0px; width: 55%;" id="tdlab2"> <div><input type="checkbox" id="chkRestoreLocation"/> Create new label for restore</div></td>
</tr>
後,我在jQuery的controling元素
if (currentID == "tabGmail") {$('tr[id$=trCustomLabel]').css("display", "block");}
if (currentID == "tabDrive") { $('tr[id$=trCustomLabel]').css("display", "block");}
if (currentID == "tabContact") {$('tr[id$=trCustomLabel]').css("display", "none");}
輸出:
,最好添加一個動態類,而不是實際的CSS的 – yuvi
@Michiel是的,我如果你只是想隱藏和顯示元素,然後使用'.hide()'和'.show()'函數 – arun