IN a JavaScript Event I only have access to a string in this format below...
var innerHTML = '<img src="https://avatars3.githubusercontent.com/u/7988569?v=3&s=40"
class="item-image picker-item-thumb"><i id="2">Item 2</i>';
I need to extract the ID value from this part <i id="2"> so I would have 2 in a variable.
Also none of the other HTML tags will ever have an ID besides the <i>
I'm not sure how to do this?
ielement and access itsidproperty.innerHTMLof aDocumentFragment. Then use DOM methods to access the elements and attributes.$("<div>", {html: innerHTML}).find("i").attr("id")Element.idin JavaScript if you're working on the DOM.$(innerHTML).filter('i')[0].id;