I need to add a text-box (within a container) on click of link.
Text-box will have value equal to ‘href’ of a link
My jQuery code is like:
jQuery("a.link").click(function(event){
jQuery('#link-container-text').text('<input type="text" onclick="this.select();" value="' + this.href + '" />');
});
But instead of showing the text-box, it’s showing me HTML code.
I need text-box, not HTML code.
EDITED
On click of another link, How can I remove just-added input from #link-container-text.
use .append or .html()
.text is for value
removal of the added element