A
A
Alexey Sklyarov2017-01-28 00:12:52
JavaScript
Alexey Sklyarov, 2017-01-28 00:12:52

Why does the modal window not close when clicking on a link in it?

There is a simple function

$(document).ready(function(){
  $('#menu-item-18 > a').click(function(){
    $('#mobile-menu-full').modal('hide');
  }); 
});

The idea is this: there is a modal window that works like a menu block (on the phone). When you click on a link in this modal window, it should close. But it doesn't close. What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iBird Rose, 2017-01-28
@0example

everything should work. mb made a mistake somewhere in the classes or id
https://jsfiddle.net/qq6sgfvr/
ps but in general the bootstrap has an attribute to close the modal data-dismiss="modal"
add it to the link and you won't have to write js code

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question