Thursday, July 14, 2011

Get elements from html string.

some time we have a html content as a string need to get the elements from string, i meet the same problem in my project and searching a while in google and finally i decided to create a dummy div and insert the html string in that div element using

document.getElementById('div').innerHtml = htmlstring;

from that div i can get all html elements as object.

div.getElementsByName("*");

using this I got  the elements a array and while we can get each object.

No comments:

Post a Comment