R
R
Rustam Gatin2015-09-22 10:22:33
JavaScript
Rustam Gatin, 2015-09-22 10:22:33

How to fix jQuery dropdown issue?

Found an example of a dropdown box on a toaster jsfiddle.net/iiil/7Ly6y/3

$('a').on('click', function(e){
    e.preventDefault();
    $('.modal').toggleClass('active');
});


<div class="wrap">
    <div class="modal"></div>
    <div class="header">
        <a href="#">режим работы</a>
    </div>
</div>


But jQuery specifies that when you click on any tag , this window will drop out, that is, I can’t even place a link in this window, because when clicked, it closes. And this applies to all links on the page. I changed the tag to but the situation is the same, only when you click on any text. Please help me how to fix the code so that the window opening is attached to only one link? PS I don't understand anything about JS and jQuery, especially :( <a><a><p>


Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stalker_darkway, 2015-09-22
@gatin

$('.menu-item-45 a')

K
Kirill Turovnikov, 2015-09-22
@turovnikoff

Why invent something? your link has a class - .popup-signin, use it in the script, at the moment the popup has not dropped out, this is how it should be:

$('.popup-signin').on('click', function(e) {
    e.preventDefault();
    $('.modal').toggleClass('active');
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question