How to check “checkbox” dynamically - jQuery Mobile

前端 未结 3 892
一个人的身影
一个人的身影 2020-11-27 07:33

With HTML a checkbox is created like this:

Category1
<
3条回答
  •  爱一瞬间的悲伤
    2020-11-27 07:55

    You need to refresh it after changing its' .prop, using .checkboxradio('refresh'). This is the correct way to check checkbox/radio in jQuery Mobile.

    Demo

    $('.selector').prop('checked', true).checkboxradio('refresh');
    

    Reference: jQuery Mobile API

提交回复
热议问题