Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-15-2013, 07:56 PM   PM User | #1
sbhmf
New Coder

 
Join Date: Jan 2013
Location: Sunnyvale, CA
Posts: 39
Thanks: 3
Thanked 1 Time in 1 Post
sbhmf is an unknown quantity at this point
Question How do I access node's complete HTML via jQuery

Consider...

<elem id="node">
<child>1</child>
<child>2</child>
</elem>


$('elem').html() will retrieve '<child>1</child><child>2</child>'.

What will my notation be to retrieve '<elem id="node"><child>1</child><child>2</child></elem>' ?
sbhmf is offline   Reply With Quote
Old 03-15-2013, 08:13 PM   PM User | #2
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,452
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
Code:
$('elem')[0].outerHTML
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.8% IE9:11.4% IE10:6.5%
rnd me is offline   Reply With Quote
Old 03-15-2013, 10:55 PM   PM User | #3
sbhmf
New Coder

 
Join Date: Jan 2013
Location: Sunnyvale, CA
Posts: 39
Thanks: 3
Thanked 1 Time in 1 Post
sbhmf is an unknown quantity at this point
thx. should have occurred to me to use the DOM
sbhmf is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:13 PM.


Advertisement
Log in to turn off these ads.