Value of jQuery generated checkbox in IE8 is stored as “on” rather than actual value?

后端 未结 3 1254
北恋
北恋 2021-01-23 03:41

The following example code works in FireFox but IE is causing problems.

This code essentially renders a list of dynamic checkboxes according to a JSON array.

Whe

3条回答
  •  春和景丽
    2021-01-23 04:27

    I find the .map function to be useful for this scenario. No need to strip off a trailing ',' with this usage.

    $('#ProfSelector input:checkbox:checked').map(function() {
      return this.id;
      // or jquery object 
      // return $(this).val();
    }).get().join(',');
    

提交回复
热议问题