Anchor Tag displayed as Text when dynamically replaced by Jquery -


i have following jquery code inmy javascript.

$('body:first :not(:has(*))').text(function (i, v) {    return v.replace(/(0\s?)([1-8]\s?)(\d\s?){8,9}/g, "<a class='phone_number_clicked' href=\"javascript:;\">$&</a>"); }); 

i loop through body , find text match particular regex , replace hyperlink.

however, when run page instead of hyperlink appearing anchor tag displayed.

can please help

the solution change ".text()" in above code ".html()" , did trick. earlier replacing expression text instead of html.

$('body:first :not(:has(*))').html(function (i, v) {    return v.replace(/(0\s?)([1-8]\s?)(\d\s?){8,9}/g, "<a class='phone_number_clicked'    href=\"javascript:;\">$&</a>"); }); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -