Example: http://jsfiddle.net/axfsD/1/
I’m trying to strip HTML tags in my pages.
I pasted below also two examples. By using replace command i can’t strip first button’s tags, but i can’t strip second one’s tags.
What can be the problem?
< script >
$('button').replace(/<.*?>/g, "");
< /script>
<button class="btn btn-info" rel="popover" data-content="hic
aslinda sen de olabilir " data-original-title="Gemlik Bursa">
<small><span title="">mihan tosun</span></small></button>
<button class="btn btn-info" rel="popover"
data-content="Benim olan benimdir Baskasinda gorduysen bil ki vazgecmisimdir "
data-original-title=""> <small><span title="">
Senin TAMER</span></small></button>
Your problem is because replace() is a native JS function, not a jQuery one. So it won’t repeat on all buttons. This is another way to do it that is more robust.