Why does not the function of checking the presence of element in the parent?

Hello. Can't understand why the function does not work.

$('ul.menu>li>a').click(function() {
 if($(this).closest('li').find('ul')) {
 return false;
 } else {
 return true;

I.e. when clicking on link inside of the li tag I am trying to make a condition for the presence of the ul inside parent li, but for some reason always given as return false, even when this is the ul inside parent li
June 14th 19 at 18:21
0 answer

Find more questions by tags JavaScript