vendredi 26 décembre 2014

Jquery if div toggled is already visible


i have a div that i want to toggle on click.If div is already visible i dont want my toggle function be executed. Here is my code and for some reasont it's not working propper. JsFiddle here



<script>
$( document ).ready(function() {
if ($("#toggled").is(":hidden"))
{
$(".test" ).click(function() {
$("#toggled").toggle();
});
}
else
{

}
});
</script>




Aucun commentaire:

Enregistrer un commentaire