Dynamic dual menu
Good afternoon, who reads. I am asking for help in a situation that I cannot solve .... I tried to make a double navigation menu - clicking on one from the first navigation menu will load into the "top_menu" block - options from the second menu; and the option in the second menu will load the content to block the content.
dynamic click which I am implementing in the following function:
$(document).ready(function() {
$('#link_from_first_menu').click(function () {
$("#top_menu").load("first_option_from_second_menu.php");
return false;
});
});
So this part works, I mean, I loaded the second menu from the first one fine, but when I have a similar function to load content from the second menu, it doesn't load content ...
$('#link_from_second_menu').click(function () {
$("#content").load("content_from_second_menu.html");
return false;
});
So, as a result, I have the first menu and the second, but I cannot load the content from the second. Please help me understand this or please give me another option to do this.
source to share
Ok you can try .on ('click')
$(document).on('click','#link_from_second_menu',function () {
$("#content").load("content_from_second_menu.html");
return false;
});
instead
$('#link_from_second_menu').click(function () {
$("#content").load("content_from_second_menu.html");
return false;
});
can my answer help you .. and has always been used instead of .on ('click') instead of .click () specifically after adding or uploading
source to share