I want to access the element from a HTML string using JQuery.
I have a following AJAX function which returns HTML text on success. I wish to extract only the contents of the tag from that HTML text using Jquery.
suppose i have a variable resp containing HTML content. I want to access the contents of the tag inside this HTML content as below..
var resp = "<html><head></head><body><form action="changePassword" name="fmChangePassword"> .... form elements .... </form></body> </html>"
alert(resp); //this alerts the full HTML content properly
alert($(resp).find("form").html()); //trial 1 -- returns NULL
var test = $(resp).find("#changePassword"); //#changePassword is the ID of the form
//alert(test.html());
displayChangePwdWindow(test); //need to pass the form content here
I tried using .find() but no success.
Can anyone help me how to do this?