Javascript 使用第一个复选框启用无线电列表

Javascript 使用第一个复选框启用无线电列表,javascript,php,Javascript,Php,列出的收音机已禁用,现在我想在选中复选框时启用它们,而在未选中复选框时将禁用它们 <p>1.0 Educational Qualification</p> <p><input type="checkbox" id="chk" name="chk"/>1.1 Highest relevant academic degree or educational attainment</p> <p><input type="

列出的收音机已禁用,现在我想在选中复选框时启用它们,而在未选中复选框时将禁用它们

 <p>1.0 Educational Qualification</p>
 <p><input type="checkbox" id="chk" name="chk"/>1.1 Highest relevant academic degree or educational attainment</p>
 <p><input type="radio" name="educationalqualification" disabled="true"/>Doctorate</p>
 <p><input type="radio" name="educationalqualification" disabled="true"/>Master's Degree</p>
 <p><input type="radio" name="educationalqualification" disabled="true"/>LLB and MD</p>
 <p><input type="radio" name="educationalqualification" disabled="true"/>Diploma Course (Above Bachelor's Degree)</p>
 <p><input type="radio" name="educationalqualification" disabled="true"/>Bachelor's Degree</p>

</body>

1.0教育资格

1.1最高相关学历或教育程度

博士学位

硕士学位

法学学士和医学博士

文凭课程(学士学位以上)

学士学位

试试这个

 <script>
 $(document).ready(function(){
    $("input[type='checkbox']").click(function(){
        if($(this).is(":checked"))
        {
            $("input[type='radio']").prop("disabled",false);
        }
        else
        {
            $("input[type='radio']").prop("disabled",true);
                    $("input[type='radio']").prop("checked",false);
        }
    });
 });
 </script>

$(文档).ready(函数(){
$(“输入[type='checkbox'])。单击(函数(){
如果($(this).is(“:checked”))
{
$(“input[type='radio']”)prop(“disabled”,false);
}
其他的
{
$(“input[type='radio']”)prop(“disabled”,true);
$(“input[type='radio']”)prop(“checked”,false);
}
});
});
请参见

试试这个

 <script>
 $(document).ready(function(){
    $("input[type='checkbox']").click(function(){
        if($(this).is(":checked"))
        {
            $("input[type='radio']").prop("disabled",false);
        }
        else
        {
            $("input[type='radio']").prop("disabled",true);
                    $("input[type='radio']").prop("checked",false);
        }
    });
 });
 </script>

$(文档).ready(函数(){
$(“输入[type='checkbox'])。单击(函数(){
如果($(this).is(“:checked”))
{
$(“input[type='radio']”)prop(“disabled”,false);
}
其他的
{
$(“input[type='radio']”)prop(“disabled”,true);
$(“input[type='radio']”)prop(“checked”,false);
}
});
});
请参见

试试这个

 <script>
 $(document).ready(function(){
    $("input[type='checkbox']").click(function(){
        if($(this).is(":checked"))
        {
            $("input[type='radio']").prop("disabled",false);
        }
        else
        {
            $("input[type='radio']").prop("disabled",true);
                    $("input[type='radio']").prop("checked",false);
        }
    });
 });
 </script>

$(文档).ready(函数(){
$(“输入[type='checkbox'])。单击(函数(){
如果($(this).is(“:checked”))
{
$(“input[type='radio']”)prop(“disabled”,false);
}
其他的
{
$(“input[type='radio']”)prop(“disabled”,true);
$(“input[type='radio']”)prop(“checked”,false);
}
});
});
请参见

试试这个

 <script>
 $(document).ready(function(){
    $("input[type='checkbox']").click(function(){
        if($(this).is(":checked"))
        {
            $("input[type='radio']").prop("disabled",false);
        }
        else
        {
            $("input[type='radio']").prop("disabled",true);
                    $("input[type='radio']").prop("checked",false);
        }
    });
 });
 </script>

$(文档).ready(函数(){
$(“输入[type='checkbox'])。单击(函数(){
如果($(this).is(“:checked”))
{
$(“input[type='radio']”)prop(“disabled”,false);
}
其他的
{
$(“input[type='radio']”)prop(“disabled”,true);
$(“input[type='radio']”)prop(“checked”,false);
}
});
});
请参见

尝试以下操作:

 $(document).ready(function(){
       $('#chk').click(function () {
           if($(this).prop('checked')){
             $('input[name=educationalqualification]').attr("disabled",false);
           }
           else {
             $('input[name=educationalqualification]').attr("disabled",true);  
           }
    });
  });
试试这个:

 $(document).ready(function(){
       $('#chk').click(function () {
           if($(this).prop('checked')){
             $('input[name=educationalqualification]').attr("disabled",false);
           }
           else {
             $('input[name=educationalqualification]').attr("disabled",true);  
           }
    });
  });
试试这个:

 $(document).ready(function(){
       $('#chk').click(function () {
           if($(this).prop('checked')){
             $('input[name=educationalqualification]').attr("disabled",false);
           }
           else {
             $('input[name=educationalqualification]').attr("disabled",true);  
           }
    });
  });
试试这个:

 $(document).ready(function(){
       $('#chk').click(function () {
           if($(this).prop('checked')){
             $('input[name=educationalqualification]').attr("disabled",false);
           }
           else {
             $('input[name=educationalqualification]').attr("disabled",true);  
           }
    });
  });
和香草:

function toggle(checked) {
    var names = document.getElementsByName("educationalqualification");

    for (var i = 0; i <= names.length - 1; i++) {
        names[i].disabled = !checked;
        names[i].checked = false;
    }
}

var check = document.getElementById("chk");
check.addEventListener("click", function () {
    toggle(this.checked)
});
功能切换(选中){
var name=document.getElementsByName(“教育资格”);
对于(var i=0;i和香草:

function toggle(checked) {
    var names = document.getElementsByName("educationalqualification");

    for (var i = 0; i <= names.length - 1; i++) {
        names[i].disabled = !checked;
        names[i].checked = false;
    }
}

var check = document.getElementById("chk");
check.addEventListener("click", function () {
    toggle(this.checked)
});
功能切换(选中){
var name=document.getElementsByName(“教育资格”);
对于(var i=0;i和香草:

function toggle(checked) {
    var names = document.getElementsByName("educationalqualification");

    for (var i = 0; i <= names.length - 1; i++) {
        names[i].disabled = !checked;
        names[i].checked = false;
    }
}

var check = document.getElementById("chk");
check.addEventListener("click", function () {
    toggle(this.checked)
});
功能切换(选中){
var name=document.getElementsByName(“教育资格”);
对于(var i=0;i和香草:

function toggle(checked) {
    var names = document.getElementsByName("educationalqualification");

    for (var i = 0; i <= names.length - 1; i++) {
        names[i].disabled = !checked;
        names[i].checked = false;
    }
}

var check = document.getElementById("chk");
check.addEventListener("click", function () {
    toggle(this.checked)
});
功能切换(选中){
var name=document.getElementsByName(“教育资格”);


对于(var i=0;i谷歌发现的所有方法都有什么问题?很多:谷歌发现的所有方法都有什么问题?很多:谷歌发现的所有方法都有什么问题?很多:谷歌发现的所有方法都有什么问题?很多:谢谢,但是如果选中复选框时,单选按钮将被清除?单选按钮将被清除意味着?请解释更多信息?当我取消选中复选框时,单选按钮列表将被禁用,但我选择的单选按钮仍然被选中,即使它被禁用。当我取消选中复选框时,它应该被取消选中。
$(“输入[type='radio']).prop(“选中”,假)
将这一行附加到else条件中谢谢,但是如果选中复选框,是否有可能清除单选按钮?单选按钮将被清除意味着?请解释更多?当我选中复选框时,单选按钮列表将被禁用,但我选择的单选按钮仍然被选中,即使它被禁用ed。当我取消选中复选框时,应该取消选中它。
$(“input[type='radio']”)。prop(“checked”,false)
将这一行附加到else条件中谢谢,但是如果选中复选框,是否有可能清除单选按钮?单选按钮将被清除意味着?请解释更多?当我选中复选框时,单选按钮列表将被禁用,但我选择的单选按钮仍然被选中,即使它被禁用ed。当我取消选中复选框时,应该取消选中它。
$(“input[type='radio']”)。prop(“checked”,false)
将这一行附加到else条件中谢谢,但是如果选中复选框,是否有可能清除单选按钮?单选按钮将被清除意味着?请解释更多?当我选中复选框时,单选按钮列表将被禁用,但我选择的单选按钮仍然被选中,即使它被禁用ed。当我取消选中复选框时,应该取消选中它。
$(“input[type='radio']”)。prop(“checked”,false)
在else条件中追加此行谢谢,但是如果选中复选框,是否有可能清除单选按钮?谢谢,但是如果选中复选框,是否有可能清除单选按钮?谢谢,但是如果选中复选框,是否有可能清除单选按钮?谢谢,但是没有如果选中复选框,是否有可能清除单选按钮?