Friday, 15 March 2013

Removing @ from the link using javascript or php -



Removing @ from the link using javascript or php -

i have string in next format, here want remove @ link, should remove @ link, if it's outside the link should not remove.is there way in javascript achive this?

note:there multiple anchor tags in string.

is possible php?

var string="test <a href='/group/profile/1'>@test user</a>";

the output should

test <a href='/group/profile/1'>test user</a>

try utilize .replace('src','target'), accomplish task

var string = "test <a href='/group/profile/1'>@test user</a>"; string = string.replace('@',''); console.log(string); //test <a href='/group/profile/1'>test user</a> demo

or can do,

var string = "test <a href='/group/profile/1'>@test user</a>"; string = string.split('@').join(''); console.log(string); //test <a href='/group/profile/1'>test user</a> demo

javascript php jquery

No comments:

Post a Comment