syntax:$.each ( container, callback )
return type:void, array, object
content:ใช้เข้าถึงแต่ละ element ภายใน container
โดยถ้า container เป็น array แล้ว function callback จะมี parameter คือ index of array และ item ตามลำดับ
แต่ถ้า container เป็น object แล้ว function callback จะมี parameter คือ property และ value ตามลำดับ
example:var tobject = { one:1, two:2, three:3 };
$.each ( tobject, function ( prop, value ) {
alert ( "Properties is : " + prop + " have a value is : " + value );
});
var tarray = [ 'one', 'two', 'three' ];
$.each ( tarray, function ( index, value ) {
alert ( "The index at : " + index + " have a value is : " + value );
});