开发者

Why does not Opera 9.6 work with Jquery context selector in my code

please help The jQuery Code:

jQuery.ajax({url:nextPortionLink,
             success: function(data) {
               nextPortion = jQuery("#productList", data).html();
             }});

Variable data has html page with #productList, .productImage, a, img...

But any of these selectors doesn't work here. Why?

jQuery(data).find("anything") doesn't work either

nextPortion == null开发者_JAVA技巧 for Opera 9.6

This code works fine with IE7,8 FF3-4 but not in Opera 9.6 and IE9


check jQuery's dataType, should be "html":

jQuery.ajax({
    url:nextPortionLink,
    dataType: "html",
    success: function(data) {
        nextPortion = jQuery("#productList", data).html();
    }
});

you must be sure that your jQuery obj is of dataType 'html', if not (OP will return null) you can force it to be 'html' using:

var data = jQuery(data).html();

find working example here: http://jsfiddle.net/aA3VN/1/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜