John Davidson

javascript - Why Wordpress dont't see my js function when i try to inner it to the site?

0 comments
Message:


I am fixing bugs in WordPress first time. I have a menu when it is the mobile version of cite it creating into the burger menu and is hidden at the right of the screen because has opacity: 0 and transform: translate(100%,0). I create a simply js function that must create style opacity: 1 and transform: 0, but I don't know where I need to put this function. Help me please!!!


This image have onClick Event:


<span id="myBtn" class="btn-menu js-menu"><i></i></span>

Here is my js function:


<script type="text/javascript"> 
document.getElementById("myBtn").addEventListener("click", function() {
document.getElementById("lestOfItem").style.opacity = 1;
document.getElementById("lestOfItem").style.transform = "inherit";
document.getElementById("lestOfItem").style.width = "100%";
document.getElementById("lestOfItem").style.textAlign = "center";
});
</script>

Menu which must be opened when i click into the image:


 <ul id="lestOfItem" class="">
---items---
</ul>


My Answer:
use JavaScript as its primary programming language?

WordPress is primarily built using PHP, which is a server-side scripting language that is commonly used for web development. While JavaScript is a powerful and versatile language that is commonly used for front-end development, WordPress has historically been built using PHP because it is well-suited for handling server-side tasks such as database interactions and content management.

That being said, WordPress does use JavaScript for certain front-end functionalities, such as dynamic content loading, interactive elements, and user interface enhancements. In recent years, there has been a shift towards incorporating more JavaScript into WordPress development, with the introduction of the REST API and the Gutenberg block editor, which are both built using JavaScript.

Overall, while WordPress may not use JavaScript as its primary programming language, it does leverage the language for various aspects of its functionality and continues to evolve to incorporate more JavaScript into its core features.

Rate this post

4 of 5 based on 3840 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us