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

177
Visualizações
Gm Script to click a radio button only highlights it, doesnt click it

I have a questionnaire (Yes/No questions) on a webpage that I need to create a grease-monkey script for, which will auto-select all "Yes" options (radio buttons with value yes in the page). I created the below script, but when I click the button it only highlights the "yes" option but does not actually click/select it.

Below is the code, which I believe is pretty straightforward. What could be wrong here:

var input=document.createElement("input");
input.type="button";
input.value="GreaseMonkey Button";
input.onclick = showAlert;
document.body.appendChild(input);

function showAlert()
{
    var btns = document.querySelectorAll('input[type="radio"]')
        for(var i=0;i<btns.length;i++){
           if(btns[i].value=="Yes"){
            btns[i].checked=true;
        }
    }
}

it only highlights it as per this pic

about 4 years ago · Juan Pablo Isaza
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