I have plain text with HTML tags and some text in quotation marks. I want to add span to text inside quotes. eg:
<p>A quick "brown" fox "jumps" over <a href="www.gamescottage.com">the</a> lazy dog.</p>
And I want to change this line like this:
<p>A quick "<span>brown</span>" fox "<span>jumps</span>" over <a href="www.gamescottage.com">the</a> lazy dog.</p>
and I use this code for this:
<script>
$('document').ready(function (){
var text = $('p').html();
text = text.replace(/"(.*?)"/g, '"<span class="quote">$1</span>"');
$('p').html(text);
});
</script>
but does it replace the HTML anchor tag quotes, as well as any solution? In short, I just want to add the spanquotes inside the quotes, ignoring the quotes of the HTML tags.
source
share