Vishnu
Vishnu

Reputation: 2452

Jquery mobile checking checkbox dynamically is not working

I have have checkbox from jquery mobile

     <form>
    <input class="checkclass"   name="d11" id="checkbox-mini-0" data-mini="true" type="checkbox">
    <label for="checkbox-mini-0">Completed This.</label>
   </form>
         <br><br>
         <div id="checkit">check</div>

I am trying to check dynamically based on name="d11" using below js

$('#checkit').click(function() {
$("input[name='d11']").prop('checked', true);
    alert("hi");
});

here is the fiddle ..http://jsfiddle.net/w2jJs/ ..But its not working in jquery mobile.some one please guide me where i am wrong

Upvotes: 1

Views: 948

Answers (1)

Anton
Anton

Reputation: 32581

You need to use .checkboxradio() for jQuery mobile

$('#checkit').click(function () {
    $("input[name='d11']").prop('checked', true).checkboxradio('refresh');
});

DEMO

Upvotes: 1

Related Questions