How to select only one checkbox at a time in javascript example?

Today, We want to share with you only one checkbox selected at a time in javascript.In this post we will show you uncheck other checkboxes on selection of one checkbox javascript, hear for allow only one checkbox to be checked using javascript we will give you demo and example for implement.In this post, we will learn about Only one checkbox can be checked with an example.

how to select one checkbox from multiple checkboxes in javascript?

In following example use for you to do select at a time one.

Example 1: index.html



	Select only one checkbox at time
	


	Laptop 
    Mobile  
    Iphone  
    Computer  
    LCD  
    


Using JavaScript

HTML Code

 Laptop 1
 Mobile 2
 Computer 3
 LCD 4

JavaScript Code

function getSelectItemThat(id) {
    for (var i = 1;i <= 4; i++)
    {
        document.getElementById(i).checked = false;
    }
    document.getElementById(id).checked = true;
}

I hope you get an idea about how to select one checkbox from multiple checkboxes in javascript?.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment