Hi I am trying to append url from the server and show the link to the user to click it but the 'click' doesn't work. Can you help me fix it?
Thank you!
$("#uurl").append("<p><a target='_blank' href="+data[1]+">"+data[1]+"</a></p>")
Hi I am trying to append url from the server and show the link to the user to click it but the 'click' doesn't work. Can you help me fix it?
Thank you!
$("#uurl").append("<p><a target='_blank' href="+data[1]+">"+data[1]+"</a></p>")
I would recommend you to create element's using jQuery. It will prevent you from quotes mess.
//Create anchor
var a = $('<a />', {
"target" : "_blank",
"href" : data[1],
"text" : data[1]
});
//Create paragraph and append anchor
var p = $('<p />').append(a);
//Append Paragraph
$("#uurl").append(p)
replace your code with
$("#uurl").append("<p><a target='_blank' href='"+data[1]+"'>"+data[1]+"</a></p>")
$("#uurl").append("<p><a target='_blank' href='"+data[1]+"'>"+data[1]+"</a></p>")
Should work. You forgot quotes for the href attribute's value
You are missing quotes around href, try putting it using escape character
$("#uurl").append("<p><a target='_blank' href=\""+data[1]+"\">"+data[1]+"</a></p>")
You are missing some quotes...
use:
$("#uurl").append("<p><a target='_blank' href='"+data[1]+"'>"+data[1]+"</a></p>")