onlinecode

Select only one checkbox at a time using Jquery

Select only one checkbox at a time using Jquery

In this post we will give you information about Select only one checkbox at a time using Jquery. Hear we will give you detail about Select only one checkbox at a time using JqueryAnd how to use it also give you demo for it if it is necessary.

If you need to select one checkbox at a time in multiple checkbox, i mean you want to allow anly one checkbox user can check then you can do easily using jquery. jquery prop() through you can give attribute value checked equel to true or false.

if you have banch of checkbox like as example, and if you want to check checkbox at time one by using jquery then you can use this code. In following example use for you to do select at a time one.

Example:

<html>

<head>

<title>Select only one checkbox at time</title>

<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

</head>

<body>

<input value="1" name="subject" type="checkbox">Subject 1

<input value="2" name="subject" type="checkbox">Subject 2

<input value="3" name="subject" type="checkbox">Subject 3

<input value="4" name="subject" type="checkbox">Subject 4

<input value="5" name="subject" type="checkbox">Subject 5

<script type="text/javascript">

$('.subject-list').on('change', function() {

$('.subject-list').not(this).prop('checked', false);

});

</script>

</body>

</html>

Hope this code and post will helped you for implement Select only one checkbox at a time using Jquery. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Exit mobile version