I have something like that :
<ul>
<li>
...
</li>
<li>
Office
<table>
.......
</table>
</li>
</ul>
And i want to replace Office with <h3>Office</h3> so i did :
$("li:contains('Office')").replaceWith('<h3>Office</h3>');
But it’s replacing me all the <li> (so it deletes the table too…) I know it’s normal but how to replace just the text Office please ?
Use
.contentsand.eqto select just the first node.Example: http://jsfiddle.net/ppqvt/