I am trying to use html() function of jquery over the specific child like:
<div id="main">
<p>I am p tag</p>
<span> i am span tag</span>
</div>
Now if we use $("#main").html() it gives both p and span but if i want only p, what should i do?
Try like below,
Try below for outerHTML,
Or you can make it as jQuery function so you can chain.
DEMO: http://jsfiddle.net/skram/PMjKR/1/
Ref: Get selected element's outer HTML