I am new to JQuery, so this may be a stupid question, however I have not been able to find a solution.
I have a raw HTML string stored as a JS variable, as shown below. What I would like to do is parse the HTML string as a DOM object, and be able to access and change any children within the div by their id.
So, I would need to access "ht" and "vt" by id after the raw HTML is parsed. How would I perform this?
var htmlStr = "<div><span id='ht'>test 1</span><span id='vt'>test 2</span></div>";
$(htmlStr).ht // Something like this, that would return "test 1"
I am basically trying to use some raw HTML as a template for creating items in an unordered list. I would create the new list item using the template, and then replace certain portions of the template with data from a web service.
Thanks