I have a custom dropdown menu that works perfectly fine when I add the script on the main html file but when i link it from an external JS file, the function seems to act faulty. It is not showing output.
This is the Script
$('.tc-navigation > a').click(function() {
var element = $(this).parent('li');
element.children('ul').toggleClass('toto');
return false;
});
$(document).click(function() {
$('.tc-navigation > li > ul').removeClass('toto');
});
Do Jquery functions like parent(), children(), siblings() stuff like that work on an external JS file? If not, is there a way to make them work?