选择一个复选框,选择其他三个 [英] select one checkbox ane select other three

查看:63
本文介绍了选择一个复选框,选择其他三个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



i有4个chackboxes当我选择另外三个复选框时应检查

Hello

i have 4 chackboxes when i select one other three checkboxes should be checked

推荐答案

Hii



这会有所帮助! :)





Hii

This will help! :)


<div id="checkBoxDiv">
    <input type="checkbox" class="chkSiteBox" onclick="selectAllCheckBoxs(this,'checkBoxDiv')"  value="1" id="chkBox1" name="_chkBox1">
    <input type="checkbox" class="chkSiteBox" onclick="selectAllCheckBoxs(this,'checkBoxDiv')"  value="1" id="chkBox2" name="_chkBox2">
    <input type="checkbox" class="chkSiteBox" onclick="selectAllCheckBoxs(this,'checkBoxDiv')"  value="1" id="chkBox3" name="_chkBox3">
    <input type="checkbox" class="chkSiteBox" onclick="selectAllCheckBoxs(this,'checkBoxDiv')"  value="1" id="chkBox4" name="_chkBox4">
</div>





然后js代码:





Then js code:

function selectAllCheckBoxs(tis,id) {


' #' + id).find(' 输入[type =checkbox]')。each(function(i){

if
('#'+id).find('input[type="checkbox"]').each(function(i){ if(


(tis).attr( checked)){
(tis).attr("checked")) {


这篇关于选择一个复选框,选择其他三个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆