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

215
Views
why does my code work in the console but never inline

I've been hacking a little WordPress plug-in here, to make it work as I like, and I have this line to which I would like to add a class.

here is the js, that works in console, but never works inline on the page or anywhere else:

document.addEventListener('DOMContentLoaded', function() {
  jQuery(function($) {
    const perf = document.querySelector('[aria-label="Europe marker"]');
    $(perf).addClass("POP");
    console.log("custom variable perf is:", perf); /// 
    $('.POP').click(function() {
      // 
      var x = $(".mapplic-layer-down");
      var y = $(".mapplic-visible");
      // 
      console.log($(x).attr("data-floor")); // print x
      console.log($(y).attr("data-floor")); // print y
      // switch classes 
      $(x).removeClass("mapplic-layer-down, mapplic-hidden");
      $(x).addClass("mapplic-visible");

      $(y).removeClass("mapplic-visible");
      $(y).addClass("mapplic-layer-down, mapplic-hidden");
    });
  });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a class="mapplic-pin pin-pulse pin-label" aria-label="Europe marker" style="top: 24.65%; left: 48.7%; background-color: rgb(0, 84, 135); border-color: rgb(0, 84, 135); transition: transform 0s ease 0s; transform: scale(3);" data-location="1972"><span><span>9</span></span></a>

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!