Extract part of HTML document in jQuery
You can use your standard selector syntax, and pass in the data as the context for the selector. The second parameter, data in this case, is our context. $.post(“getstuff.php”, function(data){ var mainDiv = $(“#mainDiv”, data); // finds <div id=’mainDiv’>…</div> }, “html”); This is equivalent to doing: $(data).find(“#mainDiv”); Depending on how you’re planning on using this, … Read more