Hi,
Using jquery I am doing something like:
$("#someId").append("this is some text, go here.");
How can I insert a url like this safely? Is there an easier way to escape all those characters that will cause js to break?
Hi,
Using jquery I am doing something like:
$("#someId").append("this is some text, go here.");
How can I insert a url like this safely? Is there an easier way to escape all those characters that will cause js to break?
I think escape should do it:
$("#someId").append(escape('this is some text, go here'));
Try using the html function, jquery docs
I'm no expert but something like this should work
$("#someId").html("<span>this is some text, go <a href='http://google.com'>here</a></span>");
Unless I'm mistaken by what you are asking, you could do something like
link = $('<a>here</a>');
link.attr('href', 'http://www.google.com');
$("#someId").append("this is some text, go " + link);