![](/img/trans.png)
[英]How to get the Value for <nobr> tag inside the td tag using javascript not jquery
[英]wrap text inside <nobr> tag using jquery
我有<nobr>
標記中的sharepoint gererate標簽。 但是在頁面上很長,我需要使用jquery來包裝它。
<td nowrap="true" valign="top" width="113px" class="ms-formlabel"><h3 class="ms-standardheader">
<nobr>On a scale of 1 to 10, with 1 being the lowest and 10 the highest, please rate your overall satisfaction with the management and implementation of this project? Rating:</nobr>
</h3></td>
更好的選擇是刪除<nobr>
標簽。 是否可以根據文字刪除? 因為頁面上還有其他許多<nobr>
標記。
嘗試這樣做:
$('.ms-formlabel nobr').css('white-space', 'normal');
<nobr>
標記通常具有nowrap
的CSS white-space
。
如果您需要刪除nobr標簽並保留文本 ,則應
var text = $(".ms-formlabel nobr").html()
$(".ms-formlabel h3").html(text);
如果您只想刪除nobr標記並僅刪除文本:
$(".ms-formlabel nobr").remove();
好的,這聽起來像您被迫接受了<nobr>
標簽。 如果我是你,那么我只是將它們轉換為<p>
標簽。
$('nobr').each(function() {
$(this).after('<p>' + $(this).html() + '</p>');
$(this).remove();
});
如果只想將文本保留在其中,請使用.text()
而不是.html()
。 您也可以使用<div />
代替<p />
標記。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.