Reputation: 1132
$("#grouptree").treeview({
animated: "fast",
collapsed: true,
unique: true,
persist: "cookie",
toggle: function() {
window.console && console.log("%o was toggled", this);
}
});
above code is my treeview code , Each one checkbox has class='treecheck' , allow user to check only one checkbox from treeview
Upvotes: 0
Views: 1022
Reputation: 62488
you have to write change event on class treecheck
and whenever one is changed uncheck other with this class name.
You can do this way using not()
:
<input type="checkbox" class="treecheck"/>
<input type="checkbox" class="treecheck"/>
<input type="checkbox" class="treecheck"/>
<input type="checkbox" class="treecheck"/>
<input type="checkbox" class="treecheck"/>
$('.treecheck').on('change', function() {
$('.treecheck').not(this).prop('checked', false);
});
Upvotes: 1