Click here to Skip to main content
15,797,062 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have two check box in a page. now i want to set, u cant tick on both at a atime. if u tick on one check-box then another is tick off. how i do this..please help me..

Make Checkbox behave like Radio button[^]

Check the links..hope it will help you..
Share this answer
You have to use javascript for doing this.

In the javascript code, you will write code to handle the click event and deselect all other checkbox.

If you are using jQuery, then you can write:

$('#container').find('input:checkbox').each(function() {
    $(this).click(function() {
        if($(this).is(':checked')) { // If it is checked, then uncheck all other checkbox.
            $('#container').find('input:checkbox').not($(this)).attr('checked', false);

<div id="container">
    <label><input type="checkbox" value="0" />Apple</label>
    <label><input type="checkbox" value="1" />Banana</label>
    <label><input type="checkbox" value="2" />Pineapple
Share this answer
if (chk1.Checked == true)
   chk2.Enabled = false;
    chk2.Enabled = true;
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900