我需要从jquery ajax加载的图像数组中选择并显示3个中间图像
for (h=2;h<5;h++){ $('#sandbox').load('./ajax/profile.html li a')[h]; };
我希望#sandbox只显示三个图像:数字2,3和4.上面的代码不起作用
你可以在load()的回调函数中访问加载的html,
$('#sandbox').load('./ajax/profile.html li a', function(result){ $(result).find('li a:eq(1), li a:eq(2), li a:eq(3)').each(function(){ alert(this.tagName); }); })
尝试
$('#sandbox').load('./ajax/profile.html li a:eq(1),li a:eq(2),li a:eq(3)');
没有for循环
以上就是jQuery教程分享从加载Ajax的图像数组中选择一个段相关内容,想了解更多jQuery开发(异常处理)及jQuery教程关注计算机技术网(www.ctvol.com)!)。
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/jquerytutorial/558877.html