mardi 27 février 2018

jQuery If else show and hide for individual dropdown

Would like to ask how should I make it one by one to open a dropdown. Currently, when I make a click event, all of them will open. Also how can I hide it back if it was not use?

Here's my code:

<script>
$( document ).ready(function() {
if ($(".dropdown-toggle").click(function() {
        $('.dropdown-menu').show();
        else {
        $('.dropdown-menu').hide();
        }
    });
});
</script>

How can I make them open individually if I just click one of them.

Aucun commentaire:

Enregistrer un commentaire