I'm building an iPhone app using Appcelerator Titanium, and I need to convert a HTML string (which may contain invalid HTML like missing tags, not my fault) to a DOM object. In this DOM element I need to find a specific <div>
, and put the contents of this <div>
in a WebView.
Anyway, I am looking for something like the Simple HTML DOM script, which is for PHP, to search through the DOM for this <div>
. I'd like the script to scan the (invalid) HTML string, and get the innerHTML of the <div>
.
How can I best do this in JavaScript?