การกำหนด selectors ด้วย jQuery เกี่ยวกับ form
เขียนเมื่อ 14 ปีก่อน โดย Ninenik Narkdeejquery form selector
คำสั่ง การ กำหนด รูปแบบ ตัวอย่าง เทคนิค ลูกเล่น การประยุกต์ การใช้งาน เกี่ยวกับ jquery form selector
ไปที่
Copy
รูปแบบที่ 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>
กด Like หรือ Share เป็นกำลังใจ ให้มีบทความใหม่ๆ เรื่อยๆ น่ะครับ

อ่านต่อที่บทความ
-
25 Sep2008รู้จักฟังก์ชันของ jQuery ในการเรียกใช้ Attribute อ่าน 12,459
สมมติ xxx คือ selector 1.รูปแบบ $("xxx").attr(name); name คือ ช
URL สำหรับอ้างอิง
Top
Copy
ขอบคุณทุกการสนับสนุน
![]()