I have HTML in a string returned by an ajax call. I would like to get the value of an element like I would with a normal selector: $('#my_div'), not by regex.
Unfortunately I don’t know how to do this since it’s in a string…
Can anyone help?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try:
$(htmlString)will create a DocumentFragment of the String what will be accessible by jQuery.Use find() to access specific elements inside this fragment: