| $( selector, [ context ] ) | ใช้อ้างอิงถึง element ที่มี selector ตรงตามที่กำหนด |
|---|---|
| $( element ) | ใช้อ้างอิงถึง element ที่กำหนดมา |
| $( elementArray ) | ใช้อ้างอิงถึง element ที่กำหนดมา |
| $( jqueryObject ) | ใช้อ้างอิงถึง element ที่กำหนดมา |
| $( html, [ ownerDocument ] ) | ใช้สร้าง element โดยอาจจะกำหนดได้ด้วยว่าต้องการให้อยู่ใน document ใด |
| $( html, property ) | ใช้สร้าง element และกำหนด attribute ให้กับ element |
syntax:$( selector, [ context ] )
return type:element
content:ใช้อ้างอิงถึง element ที่มี selector ตรงตามที่กำหนด ( โดยถ้ากำหนด context มาด้วย จะหมายถึง จะอ้างอิงถึงเฉพาะ ที่มี selector ตรงตามที่กำหนด และต้องเป็น child element ของ context นั้นด้วย )
example:$("input:checkbox", "#form").click ( function ( event ) { alert ( "Click Event of checkbox in form that have id is form" ); } );
syntax:$( element )
return type:element
content:ใช้อ้างอิงถึง element ที่กำหนดมา เพื่อที่จะทำให้สามารถใช้ method ต่างๆของ jQuery ได้
example:var formFavourite = document.getElementById ( "form" ); $( formFavourite.elements ).show ( );
syntax:$( elementArray )
return type:element
content:ใช้อ้างอิงถึง element ที่กำหนดมา
example:var formFavourite = document.getElementById ( "form" ); var formGeneral = $( ".form" ); $( [ formFavourite.elements, formGeneral.elements ] ).show ( );
syntax:$( jqueryObject )
return type:element
content:ใช้อ้างอิงถึง element ที่กำหนดมา
example:$( $( ".form" ) ).show ( );
syntax:$( html, [ ownerDocument ] )
return type:element
content:ใช้สร้าง element โดยอาจจะกำหนดได้ด้วยว่าต้องการให้อยู่ใน document ใด
example:$( "<div id='dialog'></div>" ).appendTo ( "body" );
syntax:$( html, property )
return type:element
content:ใช้สร้าง element และกำหนด attribute ให้กับ element
example:$("<div>", { id: "dialog", click: function ( ) { alert ( $(this).text() ); } }).appendTo ( "body" );