Jquery Select All,Select None,Select Invertion

รวมโค้ด AJAX Javascript Library jQuery Framework ต่างๆ ที่ใช้ คู่กับ php Script Ajax โค้ด Ajax Prototype UI แนะนำได้ที่นี่

Moderator: mindphp, ผู้ดูแลกระดาน

ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41232
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

Jquery Select All,Select None,Select Invertion

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

Jquery Select All,Select None,Select Invertion

โค้ด: เลือกทั้งหมด

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready( function() {

// Select all
$("A[href='#select_all']").click( function() {
$("#" + $(this).attr('rel') + " INPUT[type='checkbox']").attr('checked', true);
return false;
});

// Select none
$("A[href='#select_none']").click( function() {
$("#" + $(this).attr('rel') + " INPUT[type='checkbox']").attr('checked', false);
return false;
});

// Invert selection
$("A[href='#invert_selection']").click( function() {
$("#" + $(this).attr('rel') + " INPUT[type='checkbox']").each( function() {
$(this).attr('checked', !$(this).attr('checked'));
});
return false;
});

});
</script>

<fieldset id="group_1">
<form>
<input type="checkbox" name="numbers" value="0" />
<input type="checkbox" name="numbers" value="1" />
<input type="checkbox" name="numbers" value="2" />
<input type="checkbox" name="numbers" value="3" />
<input type="checkbox" name="numbers" value="4" />
<input type="checkbox" name="numbers" value="5" />
<input type="checkbox" name="numbers" value="6" />
<input type="checkbox" name="numbers" value="7" />
<input type="checkbox" name="numbers" value="8" />
<input type="checkbox" name="numbers" value="9" />
</form>
</fieldset>.

<a rel="group_1" href="#select_all">Select All</a>
<a rel="group_1" href="#select_none">Select None</a>
<a rel="group_1" href="#invert_selection">Invert Selection</a>
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 58