Live Webinar: Prompt Engineering: Skill Everyone Must Learn Today
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Native Methods to Convert the String to a Set of DOM Nodes
WhatsApp
Gowthamraj
Nov 03
2015
863
0
0
<div id=
"div1"
></div>
<button id=
"btn"
>click</button>
$(function(){
$(
'#btn'
).on(
'click'
, function(){
// Add some HTML
parsedHtml = $.parseHTML(
"Sentence has <strong>strongly typed text</strong> in it.<br />"
);
$(
'#div1'
).append(parsedHtml);
// Append parsed HTML node names
$.each( parsedHtml, function( i, el ) {
$(
'#div1'
).append( el.nodeName +
"<br />"
);
});
});
});
jQuery
DOM nodes
Up Next
Native Methods to Convert the String to a Set of DOM Nodes