Greetings Stackoverflow Community, Today, I'm facing an issue related to JavaScript and WordPress. I have a JavaScript script named setDynamicFontHeight.js, as well as PHP documents named header.php and navbar_mobile.php, which simply executes wp_nav_menu(arguments), and it’s being called through functions.php in my WordPress theme. The arguments specify the location of the navigation bar and the wrapper class for the navbar. In setDynamicFontHeight.js, I suspect the problem arises after the //set font height comment. The script is correctly loaded via functions.php (as alerts are working) and the header.php contains markup with some WordPress functions. What I aim for the js function setDynamicFontHeight(args) to achieve is to adjust the height of a specific text based on the height of a reference object. Both the text and the reference object can be identified either by class or ID. I noticed that the function works flawlessly for the Text labeled SiteTitle, but it fails for the query selector mobileNavUl li. I believe the issue lies within that query selector or the loop processing the array generated by qs.
setDynamicFontHeight.js
function setDynamicFontHeight(textToChange, referenceObject, classOrID, referenceObjectClassOrID) {
// logic goes here
}
...