Hi,
I have html code like this:
<li>
<a href=''>Example</a> <a href='' class='sub'>Edit</a> <a href='' class='sub'>Delete</a>
</li>
and I want to remove everything after the first </a>
, including the spaces. What is the most elegant and simple way to do this?
I have achieved my purpose with the following jquery:
$('li').children(".sub").remove();
$('li').html($('li').html().replace(/ /g,''));
but the second line looks too much like a hack. Is there a better way?