I have written this quick but of code:
var navTitle = $('#nav ul').html();
var replacer = navTitle.replace('<li class="page_item page-item-73">
<a href="xxx/">x training programme</a><ul class=\'children\'>',
'<li class="page_item page-item-73"><a href="xxx/">x training programme</a
<ul id="longDropdown" class=\'children\'>');
console.log(replacer);
//$('#nav ul').html(replacer);
In the HTML it appears like this:
<li class="page_item page-item-73"><a href="xxx/">x training programme</a>
<ul class='children'>
I tried putting a \n after the in the search string however the string is not changing, I think it cannot find the src string.
Is the issue here the new line? I believe so however cannot target it.
jQuery offers the
.replaceWith()and.replaceAllmethods.Maybe even changing the text content or inner HTML will do for you
respectively