Does anybody know, if i have an object like $('#input')
how can I get the html that would make it up, like <input id="input" />
as a text string?
Thanks!
Any of the outerHTML
plugins, like this will work:
jQuery.fn.outerHTML = function() {
return jQuery('<div />').append(this.clone()).html();
}
Then just call it, e.g.:
var html = $("#input").outerHTML();
You can give it a try here, all of those plugins use basically the same concept, clone it, stick it in a container, get the innerHTML of that container.