我在使用reg表達式去除標題中不需要的空格時遇到了一些問題。這是我的代碼:正則表達式jQuery不工作
<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,'')
);
任何幫助,將不勝感激
的'只有測試的'應及時更換或整個'li'元素? – Rayon
我相信'li沒有價值'爲什麼要使用'.val()'?使用'.text()'或'.html()'根據需要 – guradio
它工作原因是什麼問題? – guradio