这是我的尝试:如何将nowrap属性设置为td元素?
function(nowrap) {
var cell = $(`'<td>'`);
//cell.wrap = wrap (not working)
}
这是我的尝试:如何将nowrap属性设置为td元素?
function(nowrap) {
var cell = $(`'<td>'`);
//cell.wrap = wrap (not working)
}
如果你想获得一个特定的td
从表,并设置其属性,那就试试吧。
首先给它的td
一个唯一的类名或id。
使用ID,写
$('#td1").attr("nowrap","nowrap");
使用类,写
$('.td1").attr("nowrap","nowrap");
尝试使用nowrap attribute,
<td nowrap="nowrap">
用css这应该与div元素的工作,不知道TD
<style type="text/css"> .nowrap { white-space: nowrap; } </style> <div class="nowrap">Content here</div>
使用CSS的+1 – bluish 2011-03-31 12:52:13
使用attr
函数。还请检查here。它说NOWRAP
已被弃用。而是使用CSS
<script>
$(function() {
var cell = $('<td></td>').attr({'NOWRAP': 'NOWRAP'}).appendTo('.tr').html('asdfsd');
});
</script>
<table>
<tr class='tr'><tr>
</table>
var $cell = $('td');
$cell.css("white-space", "nowrap");
你不能在CSS NOWRAP设置? – 2011-02-28 05:03:40