| attr ( attributeName, function ( index, attr ) ) | ใช้กำหนด ค่าข้อมูลให้กับ attribute ที่กำหนด โดยจะกำหนดให้กับทุก element ภายใน set |
|---|
syntax:attr ( attributeName, function ( index, attr ) )
return type:void, element
content:ใช้กำหนด ค่าข้อมูลให้กับ attribute ที่กำหนด โดยจะกำหนดให้กับทุก element ภายใน set
example:$("li", "ul#group").attr( "id", function ( index, attr ) { if ( index % 2 == 0 ) { return "even"; }else{ return "odd"; } } );