I have been using ajax loaded data for a while now, but I am always been puzzled by a fact I encountered: I must put any element in a form if I need to select it. Example
var url = "http:www.foo.com/page1.htm";
MyAjax('', url, 'html', '', function (data) {
alert("data=" + data);
alert($("div", data).html());
alert("find=" + $(data).find('div').html());
});
I get the entire page1.htm in the returned data, but only those elements placed in a form can be selected. What did I do wrong?
Top of dom element is the key. Puting an element in form makes it a child of the form, and thus searchable.