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

后端 未结 3 1282
北恋
北恋 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:32

    It would seem IE does not like the way the checkbox attributes are set; if that is changed to the following IE is happy: http://jsfiddle.net/tS3cs/

    $("
  • ") .append( '' ) .append( $(document.createElement('label')).attr({ 'for': 'category-' + catid }) .text(catname) ) .append( $("
    ").addClass("clear") ) .appendTo("#ProfSelector ul"); $('#category'+catid).attr('checked',selected);

提交回复
热议问题