| replaceWith ( function ( index, oldContent ) ) | ใช้ในการแทนที่ ทุก element ภายใน set โดย function จะใช้ return ค่าที่ต้องการใช้นำไปแทนที่ |
|---|
syntax:replaceWith ( function ( index, oldContent ) )
return type:void, element
content:ใช้ในการแทนที่ ทุก element ภายใน set โดย function จะใช้ return ค่าที่ต้องการใช้นำไปแทนที่ หรือ element ที่ต้องการให้ไปแทนที่
example:$("button").click(function () { $(this).replaceWith( function ( index, oldContent ) { return "<div>" + $(this).text() + "</div>"; }); });