eachåforeachçåºå«æ:
1ãforeachæ¯jsçåçæ¹æ³ï¼eachæ¯jqçæ¹æ³ï¼
ããä¾å¦ï¼
ããvar arr = ['mary','jack'];
ããarr.foreach(function(item,index){
ããããconsole.log(item,index);ãããã//mary,0 jack 1
ãã})
2ã$.each() ä¸ $(select).each()ä¹é´çåºå«
ãã2.1ã$.each() å¯ç¨äº
éåä»»ä½çéå(æ 论æ¯æ°ç»æ对象),å¦ææ¯æ°ç»,
åè°å½æ°æ¯æ¬¡ä¼ å
¥æ°ç»çç´¢å¼å对åºçå¼ï¼æ¹æ³ä¼è¿å被éå对象ç第ä¸åæ°ã
ãããã $(select).each() 主è¦ä¸ç¨äºjquery对象çéå,
$.each()