I want to activate button2 click after button1 click. Made a click function an set it on button 1 in a onclick. After clicking on button1 nothing happens, button2 is not clicked automatically
Code of button1
:
<button onclick="clickButton()" style="visibility: hidden" id="button1"
class="testClass" name="testName" value="{{ object.pk }}"
type="submit">Button1</button>
Code of button2
, in a form :
<form id="onderteken_pdf_contract" >
<button style="margin-left: 40px" id="button2"
name="arbeidscontract_id" type="submit"
class="maakVacatureButton">Button2</button>
</form>
JavaScript code :
function clickButton(){
document.getElementById("button2").click();
}
question from:
https://stackoverflow.com/questions/65909359/automatically-activate-button2-click-after-a-click-on-button-button1 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…