[jQuery] Extract tag element and closing tag

2009-11-25 Thread coldwired
Hi, I've got the following piece of code that extracts the html code contained within a clicked element: $(p,h1,h2,h3,span,li, dd, dt,b,em,strong).click(function() { alert($(this).html()); }); I want to get the containing element from this too, it's open and close tag. For example: div

Re: [jQuery] Extract tag element and closing tag

2009-11-25 Thread Richard D. Worth
See http://github.com/brandonaaron/jquery-outerhtml Here's the spoiler: alert( $('div/div').append( $(this).clone() ).html() ); - Richard On Wed, Nov 25, 2009 at 8:14 AM, coldwired co...@coolwired.net wrote: Hi, I've got the following piece of code that extracts the html code contained

Re: [jQuery] Extract tag element and closing tag

2009-11-25 Thread coldwired
Magic, that's exactly what I needed. Cheers! Colin. coldwired wrote: Hi, I've got the following piece of code that extracts the html code contained within a clicked element: $(p,h1,h2,h3,span,li, dd, dt,b,em,strong).click(function() { alert($(this).html()); }); I want to get