2011-02-28 40 views

回答

1

如果你想獲得一個特定的td從表,並設置其屬性,那就試試吧。

首先給它的td一個唯一的類名或id。

使用ID,寫

$('#td1").attr("nowrap","nowrap"); 

使用類,寫

$('.td1").attr("nowrap","nowrap"); 
1

嘗試使用nowrap attribute

<td nowrap="nowrap">

用css這應該與div元素的工作,不知道TD

<style type="text/css"> 
.nowrap { 
    white-space: nowrap; 
} 
</style> 

<div class="nowrap">Content here</div> 
+0

使用CSS的+1 – bluish 2011-03-31 12:52:13

0

使用attr函數。還請檢查here。它說NOWRAP已被棄用。而是使用CSS

<script> 
$(function() {   
     var cell = $('<td></td>').attr({'NOWRAP': 'NOWRAP'}).appendTo('.tr').html('asdfsd'); 
}); 
</script> 

<table> 
    <tr class='tr'><tr> 
</table> 
1
var $cell = $('td'); 
$cell.css("white-space", "nowrap"); 
相關問題