Question: 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?

Answer: 
Try:

```
$(htmlString).html()

```

`$(htmlString)` will create a DocumentFragment of the String what will be accessible by jQuery.

Use find() to access specific elements inside this fragment:

```
$(htmlString).find('someselector').html()

```
Took me a while to figure this out, but I had to add a wrapper to my html to get this to work, otherwise jQuery returns an array of elements, and looks inside each. 

This worked for me:

```
jQuery("<div>" + response.responseText + "</div>").find('#response_code').html()

```