表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