0

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();
}
Sander
  • 51
  • 6

0 Answers0