в следующем фрагменте кода мне нужно получить текстовый узел, который является последним дочерним элементом.
<p class="western" style="margin-bottom: 0.14in">
<font color="#000000">
<font face="Arial, serif">
<font size="1" style="font-size: 8pt">
<b>The value conclusion of the Income Approach</b>
</font>
</font>
</font>
</p>
Мне нужно выбрать текстовый узел The value conclusion of the Income Approach
, доступным является только <p>
, элементы внутри тега <p>
являются динамическими.
это еще один html.
<p class="western" style="margin-bottom: 0.14in">
<font color="#000000"><font face="Arial, serif">
<font size="1" style="font-size: 8pt">The client has specifically....</font>
</font>
</p>
В приведенном выше фрагменте мне нужно выбрать The client has specifically....
код, который я пробовал
var $html = `<div>
<p class="western" style="margin-bottom: 0.14in">
<font color="#000000"><font face="Arial, serif">
<font size="1" style="font-size: 8pt">The client has specifically....</font>
</font>
</p>
<p class="western" style="margin-bottom: 0.14in">
<font color="#000000"><font face="Arial, serif">
<font size="1" style="font-size: 8pt">The client has specifically....</font>
</font>
</p>
</div>`;
$html.find('p').each(function(){
$(this).contents().filter(function(){
return this.nodeType === 3; // Text node
}).each(function(){
var f = $(this).parent().css('font-size');
if(f && f.trim() != '')
$(this).closest('p').css('font-size', f);
});
});
Я хочу назначить такой же размер шрифта <p>
элемент собственным текстовым узлом