Advertisement
vfontjr

Count checkboxes with other

Dec 6th, 2022
1,000
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript">
  2. jQuery(document).ready(function($){
  3.     $('input[name="item_meta[643][]"], input[name="item_meta[643][other_2]"]').change(function(){
  4.     var val1 = $("input[name='item_meta[643][]']:checked").length,
  5.         val2 = $("input[name='item_meta[643][]']:checked") ? 1 : 0,
  6.         tot_count = val1 + val2;
  7.     $("#field_wzfsfs").val(tot_count);
  8.     $("#field_wzfsfs").change();
  9.     });
  10. });
  11. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement