jQuery的$().each()方法用于演示的实际用法 [英] Practical Uses for jQuery's $().each() method for a presentation

查看:69
本文介绍了jQuery的$().each()方法用于演示的实际用法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,我向一些同事进行演示,介绍如何将jQuery与ColdFusion结合使用.与高级会话相比,这更多是对jQuery的介绍.我试图说明如何使用jQuery的$().each()方法进行循环,并试图提出一些实际的实际示例,但我已经画了一个空白.有什么建议吗?

I'm giving a presentation to some coworkers today on how to use jQuery with ColdFusion. This is more of an introduction to jQuery than an advanced session. I'm trying to show how one can loop using jQuery's $().each() method, and in trying to come up with some practical, real world examples and I've drawn a blank. Any suggestions?

推荐答案

// changes every other div green
$("div").each(function(i) { if (i % 2) this.style.backgroundColor = "green"; });

这篇关于jQuery的$().each()方法用于演示的实际用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆