Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

196
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda