Checkbox with radio behavior with jQuery


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $(function() {
  2. $("input:checkbox").click(function() {
  3. if($(this).attr("checked")) {
  4. valorChecado = $(this).val();
  5. $("input:checkbox").each(function() {
  6. if($(this).val() != valorChecado && $(this).attr("checked")) {
  7. $(this).removeAttr("checked");
  8. }
  9. });
  10. }
  11. });
  12. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.