I'm having some problems using reg expression to remove unwanted spaces in my title. This is my code:
<ul>
<li>
<a href="#make/281">
<img src="/images/cook-hat.svg">
<span class="label label-primary">label</span>
<div class="title-box"><span class="title"> my title </span></div>
<span class="goal-list">4</span>
</a>
</li>
$("li").val(
$("span.title").text().replace(/\n/g, "")
.replace(/\s/g,'')
);
Any help would be appreciated
<span class="title">should be replaced or entirelielement ?li has no valuwhy use.val()? use.text()or.html()according to need