mercredi 21 janvier 2015

Javascript (jquery libs) checking checkbox

I've to checking if a checkbox is checked or not, if checkbox is checked then the div with class "1" go to shows, else "div1" hide. I've tryed with this html:



<label><input type=\"checkbox\" class=\"checkbox\" name=\"ban\" value=\"1\">Ban user</label>
<script type=\"text/javascript\" src=\"http://ift.tt/1q8JMjW\"></script>
<script type=\"text/javascript\">
document.ready(function() {
$('.checkbox').change(function(){

if ($(this).is(\":checked\")) {

$('.div1').fadeIn(\"slow\");

}

if ($(this).is(\":not(:checked)\")) {

$('.div1').fadeOut(\"slow\");
}

});

});

</script>


But don't work. How can i do? Thanks in advance experts.





Aucun commentaire:

Enregistrer un commentaire