我有三個字,我想第一個空間後,周圍添加內容的跨度,以便jQuery的間隔後,第一空間
hello world
成爲hello <span>world</span>
和
hello world again
成爲hello <span>world again</span>
任何幫助將不勝感激
在這裏編輯它是
$("#main-nav li a").each(function(index) {
$(this).html($(this).text().replace(/([\S]*)\s(.*)/, "$1 <span>$2</span>"));
});
從這些詞來自哪裏?你能告訴我們更好的理解代碼嗎? – Raman 2013-03-15 07:51:20