Shapes Posted July 9, 2021 Share Posted July 9, 2021 Hello, Could someone please tell me why .menu-sub is having a new id on each page load? I would need to trigger this menu with: document.getElementById(...) Can we safely change: #top_sub_menu_{$_expand_id} to: #top_sub_menu ? Link to comment Share on other sites More sharing options...
delete-account-pleas Posted July 9, 2021 Share Posted July 9, 2021 (edited) You can just search for all ids that start with top_sub_menu_ You need to use the ^ like this: // JQUERY var menuid = $('[id^="top_sub_menu_"]').attr('id'); // JAVASCRIPT var menuid = document.querySelector('[id^="top_sub_menu_"]').id Edited July 9, 2021 by Crezzur (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now