簡體   English   中英

當數據來自數據庫時,如何從一組復選框中僅選擇4個

[英]How we can choose only 4 from a group of checkbox when the data is coming from the database

當用戶嘗試從復選框組中選擇四個以上的值(復選框名稱位於數組中)時,我想顯示JavaScript警報

<div class="checkbox alert alert-primary">

    <p><input type="checkbox" id="calorieCheckbox" name="txt_tradesman[]" value="<?php echo $restrad['tradesman_id'] ?>" onClick="return KeepCount()"><?php echo $restrad['fullname'] ?> <p>    

</div>

這是jQuery版本:

$('[[name =“ txt_tradesman []”]:checked')。length

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM