i'm trying to make a auto click button but this one has no id i already tried multiple script, but still not able to work
document.querySelector('input[value="Suivant"]')[0].click();
<div class="frm-button">
<input type="submit" value="Suivant" class="submitbtn">
</div>
The querySelector method returns a single element (the first input element with value Suivant
) and not an array of input elements so you don't need to specify an index as seen in the following Code Snippet:
const inputElement = document.querySelector('input[value="Suivant"]');
inputElement.addEventListener('click', () => {
// log "Hello" in the console when clicked
console.log("hello");
})
// simulate a click on the input element with the click() method
inputElement.click();
<div class="frm-button">
<input type="submit" value="Suivant" class="submitbtn">
</div>