I have some HTML that is dynamically generated, so I cannot edit the HTML. The HTML looks like (1). I want it to look like (2). So basically, the string at the end of the li
's should be cut and pasted into an <a>
that is then wrapped around the other text. Also the trailing -
should get removed then.
HTML (1)
<ul>
<li>Jovanotti – L'ombelico Del Mondo - http://youtu.be/mMNPUw2bUhM</li>
<li>The Police – Roxanne - http://youtu.be/3T1c7GkzRQQ</li>
</ul>
What it should look like (2)
<ul>
<li><a href="http://youtu.be/mMNPUw2bUhM" title="">Jovanotti – L'ombelico Del Mondo</a></li>
<li><a href="http://youtu.be/3T1c7GkzRQQ" title="">The Police – Roxanne</a></li>
</ul>
It is a different question than the ones that are already asked on SO. I do not know the contents of the "url", only that it always starts with http://youtu.be
.
Here is a fiddle to play with.