jQuery - how to show message if > 1 checkbox selected?

前端 未结 1 1341
南笙
南笙 2021-01-20 12:32

Depending on the number n of cars a user has in his records, there will be n checkboxes to select from.

In my view these checkboxes are ren

相关标签:
1条回答
  • 2021-01-20 13:00

    How to show message if > 1 checkbox selected?

    You could check the length property of the :checked checkboxes.

    if ($('.checkbox:checked').length > 1) { 
       // Show message.
    };
    

    jsFiddle.

    Also, you could select those checkboxes with :checkbox selector.

    0 讨论(0)
提交回复
热议问题