I have the following HTML
<label class="editable" id="user_info_username">Hai world...</label>
now on click function i need the content of the clicked element .
i tried
$(".editable").live("click",function(){
alert($(this).html()) //returns Hai world...
});
But i need the HTML content
so <label class="editable" id="user_info_username">Hai world...</label>
Clone the clicked element, wrap it in a
<div>, and then ask for the HTML of that – something like:Working demo at http://jsfiddle.net/f88kj/
I also previously wrote a plugin that does this at https://stackoverflow.com/a/6509421/6782