我很难让这个工作起来。
我的服务器返回一个显示很棒的HTML字符串,它的格式很好。当它从服务器返回时,我这样做:
var elements = $(data);
var strats = elements.find('.myclass');
该字符串包含div
个对象,其类如:
myclass item-container another-class
元素数组如下所示:
0: div.myclass.item-container.another-class
1: text
2: div.myclass.item-container.another-class
3: text
4: div.myclass.item-container.another-class
5: text
6: div.myclass.item-container.another-class
7: text
8: div.myclass.item-container.another-class
length: 9
__proto__: Object[0]
但是当我尝试只选择div对象时,数组是空的:
context: undefined
length: 0
prevObject: jQuery.fn.jQuery.init[9]
selector: ".myclass"
__proto__: Object[0]
我尝试了各种各样的选择器,我无法弄明白。我的印象是只使用一个类名的选择器应该可以正常工作。如何获得课程divs
的{{1}}?