📅  最后修改于: 2023-12-03 14:43:08.501000             🧑  作者: Mango
jQuery Bootstrap Checkbox Val is a lightweight plugin that enables the users to get the value of all selected checkboxes in a group easily. This plugin is compatible with Bootstrap and utilizes jQuery to provide an effortless integration with your website.
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="jquery.bootstrap.checkbox.val.js"></script>
$(document).ready(function () {
var selectedValues = $('input[name="checkboxName"]:checked').getCheckboxVal();
console.log(selectedValues);
});
Note: Replace "checkboxName" with the name of your checkboxes.
You can customize the plugin to suit your needs by changing the code of jquery.bootstrap.checkbox.val.js. For example, you can change the default separator used to separate the values of multiple checkboxes using the following code.
$.fn.getCheckboxVal.defaults.separator = '/';
jQuery Bootstrap Checkbox Val is a simple yet powerful plugin that can save you time and effort when dealing with grouped checkboxes. It is easy to install, use and customize, making it an ideal choice for any web developer.