Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
Javascript doesn't work in wordpress theme

I'm running a wired issue when try to use javascript in Wordpress theme - vatage.

I tried use the Plugins - Simple Custom CSS and JS, tried put code in header and footer, both don't work.

Tried to add below in 'function.php' file, also doesn't work.

add_action('wp_enqueue_scripts', 'tutsplus_enqueue_custom_js');
function tutsplus_enqueue_custom_js() {
    wp_enqueue_script('custom', get_stylesheet_directory_uri().'/js/custom.js', 
    array(), false, true);
}

I also tested put the code direct the page as below.

<script type="text/javascript">
    let product_title_id = document.querySelector("#product-title-id")
    let offer_welcome = document.getElementById("no-welcome")
    console.log(product_title_id.innerHTML)
    console.log(offer_welcome.innerHTML)
    if (product_title_id.innerHTML.includes("ltimate")) {
        console.log("Yes, it is included.")
        console.log(offer_welcome.innerHTML)
        document.querySelector(".word-offerswelcomme").style.setProperty("display", "none", "important")
        document.querySelector(".word-offerswelcomme").style.setProperty("visibility ", "hidden", "important")
        document.getElementById("no-welcome").style.display = "none";
        document.getElementById("no-welcome").innerHTML = "";


    }
    document.querySelector(".word-offerswelcomme").style.setProperty("display", "none", "important")
    document.getElementById("no-welcome").style.display = "none";
    document.getElementById("no-welcome").innerHTML = "";


</script>

In console, the console.log works. but the if statement and the last 3 calls don't work. the .style.display = "none" works 1 second when you refresh the page, then the content pop up again.

Anyone know how to resolve this issue. I am new for wordpress. Thanks in advance

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!