how can I use jquery to find ::123:: , get 123 out(as an id) then change it into an image inside a div that has many lines.
The div:
<div id="msg">
<ul>
<li class="message">hello</li>
<li class="message">123</li>
<li class="message">thrid line ::123::</li>
<li class="message">yes</li>
<li class="message">sure</li>
<li class="message">fourth line ::123::</li>
</ul>
</div>
Results would be:
<div id="msg">
<ul>
<li class="message">hello</li>
<li class="message">123</li>
<li class="message">thrid line <img src="image?id=123"></li>
<li class="message">yes</li>
<li class="message">sure</li>
<li class="message">fourth line <img src="image?id=123"></li>
</ul>
</div>
P/S the contents in the lines are just example.
How can I do this?
This will replace any number you have inside double colons with a related
<img>tag:http://jsfiddle.net/khk4a/
You might reconsider the HTML replacement logic here, the source would be pretty awkward for a search engine or text reader. Try using another hook, f.ex an empty
<i>with a class or data attribute.