I want to parse a html string to jQuery object then find an element by ID.
I tried 3 ways bellow, but only the last works. I don\'t know why the others not works?
An alternate way to do this -
var myTestDiv = document.createElement('div'); var mystr = ''; myTestDiv.innerHTML = mystr; console.log(myTestDiv.querySelector('div#main'));