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

193
Views
Can't find class element using document.queryselector all

I can't seem to get a specific element by its class.

Here is the element:

<div id="getticketspecifictext-13827" class="ms-Panel-contentInner ms-Panel-tickets13827">

Here is the code. It fails at line 4 when trying to find the element in question:

const outputd = document.getElementById(paneltextinsert);
console.log(outputd)
console.log("ms-Panel-tickets" + ticketid)
var PanelExampleseditticket = document.getElementsByClassName(".ms-Panel-contentInner .ms-Panel-tickets" + ticketid);
console.log(PanelExampleseditticket)
PanelExampleeditticket = PanelExampleseditticket.querySelector(outputd.id);
console.log(editticketbutton.id)
console.log(PanelExampleeditticket)
var PanelExamplePaneleditticket = PanelExampleseditticket.querySelector(".freshdeskpanel");
console.log(PanelExamplePaneleditticket)
PanelExampleeditticket.addEventListener("click", function(i) {
  new fabric['Panel'](PanelExamplePaneleditticket);
});

I tried also looking for just ms-Panel-tickets"+ticketid but it wouldn't find it even though if I printed the id it works perfectly.

enter image description here

EDIT: I tried taking out the space between the two classes I was looking for and that didn't work. Like so:

".ms-Panel-contentInner.ms-Panel-tickets"+ticketid

I also tried just using .ms-Panel-tickets"+ticketid as well and it still can't be found.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You don't use . when calling getElementByClassName. It should be more like this:

var PanelExampleseditticket = document.getElementsByClassName("ms-Panel-contentInner ms-Panel-tickets" + ticketid);
about 4 years ago · Juan Pablo Isaza Report
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!