Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8035259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:15:39+00:00 2026-06-05T02:15:39+00:00

<label for=q11><input type=checkbox class=styled value= Good name=q11[] id=q11_1>Good</label> <label for=q11><input type=checkbox class=styled value= Poor

  • 0
<label for="q11"><input type="checkbox" class="styled" value=" Good" name="q11[]" id="q11_1">Good</label>
<label for="q11"><input type="checkbox" class="styled" value=" Poor" name="q11[]" id="q11_2">Poor</label>
<label for="q11"><input type="checkbox" class="styled" value=" Good" name="q11[]" id="q11_1">Good</label>
<label for="q11"><input type="checkbox" class="styled" value=" Poor" name="q11[]" id="q11_2">Poor</label>

Here is my code code I want some thing like this. Means when I check one checkbox the other checkbox should be unchech.

<input type="checkbox" class="styled" onclick="document.getElementById(q11_2).checked=false;" value="Transfer of risk > Poor" name="q11[]" id="q11_1">Poor</label>
<input type="checkbox" class="styled" onclick="document.getElementById(q11_1).checked=false;" value="Transfer of risk > Poor" name="q11[]" id="q11_2">Poor</label>

But the problem is this when i use styled class this code not work.

onclick="document.getElementById(q11_1).checked=false

but when i remove styled class it works properly.
My style class code is this.

            if(inputs[a].checked == true) {
                if(inputs[a].type == "checkbox") {
                    position = "0 -" + (checkboxHeight*2) + "px";
                    span[a].style.backgroundPosition = position;
                } else {
                    position = "0 -" + (radioHeight*2) + "px";
                    span[a].style.backgroundPosition = position;
                }
            }
            inputs[a].parentNode.insertBefore(span[a], inputs[a]);
            inputs[a].onchange = Custom.clear;
            if(!inputs[a].getAttribute("disabled")) {
                span[a].onmousedown = Custom.pushed;
                span[a].onmouseup = Custom.check;
            } else {
                span[a].className = span[a].className += " disabled";
            }
        }
    }
    inputs = document.getElementsByTagName("select");
    for(a = 0; a < inputs.length; a++) {
        if(inputs[a].className == "styled") {
            option = inputs[a].getElementsByTagName("option");
            active = option[0].childNodes[0].nodeValue;
            textnode = document.createTextNode(active);
            for(b = 0; b < option.length; b++) {
                if(option[b].selected == true) {
                    textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
                }
            }
            span[a] = document.createElement("span");
            span[a].className = "select";
            span[a].id = "select" + inputs[a].name;
            span[a].appendChild(textnode);
            inputs[a].parentNode.insertBefore(span[a], inputs[a]);
            if(!inputs[a].getAttribute("disabled")) {
                inputs[a].onchange = Custom.choose;
            } else {
                inputs[a].previousSibling.className = inputs[a].previousSibling.className += " disabled";
            }
        }
    }
    document.onmouseup = Custom.clear;
},
pushed: function() {
    element = this.nextSibling;
    if(element.checked == true && element.type == "checkbox") {
        this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
    } else if(element.checked == true && element.type == "radio") {
        this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
    } else if(element.checked != true && element.type == "checkbox") {
        this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
    } else {
        this.style.backgroundPosition = "0 -" + radioHeight + "px";
    }
},
check: function() {
    element = this.nextSibling;
    if(element.checked == true && element.type == "checkbox") {
        this.style.backgroundPosition = "0 0";
        element.checked = false;
    } else {
        if(element.type == "checkbox") {
            this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
        } else {
            this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
            group = this.nextSibling.name;
            inputs = document.getElementsByTagName("input");
            for(a = 0; a < inputs.length; a++) {
                if(inputs[a].name == group && inputs[a] != this.nextSibling) {
                    inputs[a].previousSibling.style.backgroundPosition = "0 0";
                }
            }
        }
        element.checked = true;
    }
},

    clear: function() {
    inputs = document.getElementsByTagName("input");
    for(var b = 0; b < inputs.length; b++) {
        if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
            inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
        } else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
            inputs[b].previousSibling.style.backgroundPosition = "0 0";
        } else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
            inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
        } else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
            inputs[b].previousSibling.style.backgroundPosition = "0 0";
        }
    }
},
choose: function() {
    option = this.getElementsByTagName("option");
    for(d = 0; d < option.length; d++) {
        if(option[d].selected == true) {
            document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
        }
    }
}

}
window.onload = Custom.init;

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:15:40+00:00Added an answer on June 5, 2026 at 2:15 am

    I think you need to quote the identifier.

    onclick="document.getElementById('q11_2').checked=false"
    

    Also, you might want to escape the > to &gt; in your value attribute.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A label tag is of the form: <label for=id_of_text_field> <input type=text name=example id=id_of_text_field />
Label tag coding style. Can I write my label tag like this. <input type=text
I saw someone using label as an ItemRenderer for DataGrid, the code is here.
I have a Label that displays some text like I am good. How can
I have a label with style class test in my javafx application. I wanted
My label text here I used : function Do(T){ var XcEP = $(T).parents().html().match(/^[-\s]*(.+?)[\s()\d]*$/,i)[1]); alert(XcEP);
I have a Label, let's call it currencyFormattedLabel, the value of which was earlier
I want to display label when user choose one of the value in drop
The label text of a checkbox is dynamically generated in CodeCharge. The label text
I'm using label-input pairs, with the following style for labels, but when I use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.