[英]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.