mardi 3 janvier 2017

How to set attribute in jquery after dom ready?

I want to checkbox checked in jquery after dom ready. I used dashboard template for responsive user interface.

$(document).ready(function () {
   $("#genderF").attr("checked",true);
});

html code here

<div class="col-md-6 col-sm-6 col-xs-12" style="padding-top: 8px;">
 M:
 <input type="radio" class="flat" name="gender" id="genderM" value="M" checked="" required /> F:
 <input type="radio" class="flat" name="gender" id="genderF" value="F" />
</div>

But it doesn't work well. I have to checkbox checked in static html file. And how to change checked state in jquery? As i mentioned before, i used dashboard template for ui effect and they make more elements for checkbox so even though i can set attribute to checkbox, it doesn't work well as i expected.




Aucun commentaire:

Enregistrer un commentaire