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

141
Visualizações
How do I select a DOM element that has multiple classes?

I am trying to select a DOM element that has these classes:

mq-editable-field mq-math-mode mq-field

I have tried using:

document.getElementsByClassName('mq-editable-field mq-math-mode mq-focused')

This is not working, is there another document function I should be using? I am using vanilla javascript.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Use a query selector:

document.querySelector('.mq-editable-field.mq-math-mode.mq-focused')
about 4 years ago · Juan Pablo Isaza Relatório

0

you can use querySelector and querySelectorAll for get multiple-element by classes

querySelector method : return the first element within the document which matches a specified CSS selector(s)

let firstElement= document.querySelector('.mq-editable-field.mq-math-mode.mq-focused');

querySelectorAll() method : method returns all the elements within the document which matches the specified CSS selector(s).

let elements = document.querySelectorAll('.mq-editable-field.mq-math-mode.mq-focused');
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