I have 2 buttons on a page that I can't change code:
<button type="submit" name="next" class="button">Next</button>
<button type="submit" name="back" class="button">Previous</button>
On the back button I want to use javascript to reset the values of fields on that page by using:
document.getElementById(setV).value = "0"
I need to know how to do this on the name of a button.
I can't use getElementById or class as the name is the only thing to distinguish them. I have tried the follwing to take action but no joy:
$('[name="next"]').onclick();
$('[name="next"]').click(function(){$(this).val()})document.querySelectorAll('button')[1].click(). Or you nearly got it$('button[name="next"]').click();.HTML.querySelector('[name="next"]')?