การกำหนด selectors ด้วย jQuery เกี่ยวกับ form
25 September 2008
รูปแบบที่ 1 $(":input");
ใช้ในการเลือก element ได้แก่ input , textarea , select และ button
ใช้ในการเลือก input element ที่มี type เท่ากับ text
ใช้ในการเลือก input element ที่มี type เท่ากับ password
ใช้ในการเลือก input element ที่มี type เท่ากับ radio
ใช้ในการเลือก input element ที่มี type เท่ากับ checkbox
ใช้ในการเลือก input element ที่มี type เท่ากับ submit
ใช้ในการเลือก input element ที่มี type เท่ากับ image
ใช้ในการเลือก input element ที่มี type เท่ากับ reset
ใช้ในการเลือก button และ input element ที่มี type เท่ากับ button
ใช้ในการเลือก input element ที่มี type เท่ากับ file
ใช้ในการเลือก element ที่เป็น hidden หรือ input element ที่มี type เท่ากับ hidden
ใช้ในการเลือก element ได้แก่ input , textarea , select และ button
<script language="javascript">
$(function(){
$(":input").css("backgroundColor","red");
});
</script>
รูปแบบที่ 2 $(":text");ใช้ในการเลือก input element ที่มี type เท่ากับ text
<script language="javascript">
$(function(){
$(":text").css("backgroundColor","red");
});
</script>
รูปแบบที่ 3 $(":password"); ใช้ในการเลือก input element ที่มี type เท่ากับ password
<script language="javascript">
$(function(){
$(":password").css("backgroundColor","red");
});
</script>
รูปแบบที่ 4 $(":radio");ใช้ในการเลือก input element ที่มี type เท่ากับ radio
<script language="javascript">
$(function(){
$(":radio").css("backgroundColor","red");
});
</script>
รูปแบบที่ 5 $(":checkbox");ใช้ในการเลือก input element ที่มี type เท่ากับ checkbox
<script language="javascript">
$(function(){
$(":checkbox").css("backgroundColor","red");
});
</script>
รูปแบบที่ 6 $(":submit"); ใช้ในการเลือก input element ที่มี type เท่ากับ submit
<script language="javascript">
$(function(){
$(":submit").css("backgroundColor","red");
});
</script>
รูปแบบที่ 7 $(":image"); ใช้ในการเลือก input element ที่มี type เท่ากับ image
<script language="javascript">
$(function(){
$(":image").css("backgroundColor","red");
});
</script>
รูปแบบที่ 8 $(":reset"); ใช้ในการเลือก input element ที่มี type เท่ากับ reset
<script language="javascript">
$(function(){
$(":reset").css("backgroundColor","red");
});
</script>
รูปแบบที่ 9 $(":button"); ใช้ในการเลือก button และ input element ที่มี type เท่ากับ button
<script language="javascript">
$(function(){
$(":button").css("backgroundColor","red");
});
</script>
รูปแบบที่ 10 $(":file"); ใช้ในการเลือก input element ที่มี type เท่ากับ file
<script language="javascript">
$(function(){
$(":file").css("backgroundColor","red");
});
</script>
รูปแบบที่ 11 $(":hidden"); ใช้ในการเลือก element ที่เป็น hidden หรือ input element ที่มี type เท่ากับ hidden
<script language="javascript">
$(function(){
$(":hidden").css("backgroundColor","red");
});
</script>
บทความคนเข้าอ่านวันนี้
18 Aug 10 ใช้ php ดึงรูปภาพ จากโฟลเดอร์ มาแสดง พร้อม เทคนิค แบ่งหน้า อ่าน 4561 25 Sep 08 PHP MySQL connecting script and function อ่าน 2388 30 Oct 10 การเลื่อน jQuery UI tab อัตโนมัติ ตามเวลาที่กำหนด อ่าน 5141 06 May 10 สร้าง poll แบบสำรวจ ด้วย ajax ใน jQuery อย่างง่าย อ่าน 4033 21 Mar 11 การสร้างปุ่ม facebook ล็อกอิน เว็บไซต์ แบบแสดงรูป และกำหนดเพิ่มเติม อ่าน 2588 25 Sep 08 ตรวจสอบนามสกุลไฟล์ ก่อนทำการอัพโหลด อ่าน 3270 22 Oct 08 คำสั่ง SQL HAVING อ่าน 5293 13 Oct 11 แนะนำการใช้งาน การเชื่อมต่อ facebook ด้วย php sdk v.3.1.1 อ่าน 770 02 Apr 11 การอ้างอิง object ในหน้าหลัก จากหน้า popup ด้วย jQuery อย่างง่าย อ่าน 2590 25 Sep 08 มารู้จัก effect ของ jquery อย่างง่าย ตอนที่ 3 อ่าน 3733 19 Jan 11 อักขระคั่น (Delimiters) ในการใช้งาน Regular Expressions ของ PHP อ่าน 1072 13 May 09 แก้ไขการตัดข้อความด้วย substrใน php แล้วมีรูปสี่เหลี่ยม อ่าน 2732 25 Sep 08 ซ่อนและแสดง เนื้อหาด้วย jquery แบบ Basic อ่าน 5136 07 Sep 10 ใช้ ckeditor กับ filemanager ด้วย php รองรับ ฟังก์ชัน javascript อ่าน 3438 19 Nov 10 ทางเลือก อัพโหลดไฟล์ใน ckeditor ด้วย ajax file manager อ่าน 2190 11 Nov 10 แนะนำ การแทรก swf ไฟล์ ด้วย jQuery SWFObject Plugin อ่าน 2376 08 Oct 08 คำสั่ง SQL DISTINCT อ่าน 4891 06 Nov 09 สร้าง swap แบนเนอร์ effect แบบ fade ด้วย jQuery อย่างง่าย อ่าน 4671 08 Jun 10 ป้องกัน spam ด้วย captcha คำถาม ทางคณิตศาสตร์ อย่างง่าย อ่าน 1667 04 Oct 08 SQL คืออะไร อ่าน 7496
