0
字符jQuery的插入文本我在#
一個div
像在股利
<div class="mycooldiv">
bunch of text is in here and for example some # and some other cool #
</div>
我怎樣才能插入文本 - 在#
可以在任何位置?
字符jQuery的插入文本我在#
一個div
像在股利
<div class="mycooldiv">
bunch of text is in here and for example some # and some other cool #
</div>
我怎樣才能插入文本 - 在#
可以在任何位置?
嘗試使用正則表達式替換帶有要插入文本的#號。
var $div = $('.mycooldiv');
$div.text($div.text().replace(/#/, 'Text to insert here');
ah right cool - good ole'replace' – Andy