TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Native Methods to Convert the String to a Set of DOM Nodes
Gowthamraj
Nov 03
2015
Code
812
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
<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