0

i am trying to submit the form automatically using javascript. But unable to do so. Below is the target submit.

<input id="jpform:jpsubmit" type="submit" name="jpform:jpsubmit" value="Submit" tabindex="3" onclick="return validateJPJD();">

I have tried below steps. But doesn't work.

Javascript:

function Travel() {
    return validateJPJD();
}
Travel()`

document.getElementById('jpform:jpsubmit').onclick();

document.getElementById('jpform:jpsubmit').submit();

Can someone please help me?

Alternatively, This form get submitted with enter button. But i dont the equivalent of this as well.

clemens
  • 16,716
  • 11
  • 50
  • 65
  • 1
    That’s a submit button. Where’s the form? (You can call `.click()` on the submit button, but `.submit()` on the form is nicer.) – Ry- Oct 15 '17 at 06:54
  • 1
    There is no such method `onclick()` on `button` element maybe you've meant `click()`? – Krusader Oct 15 '17 at 06:58
  • You should not call `submit()` on the button, but rather on the form element. – Bergi Oct 15 '17 at 10:22

0 Answers0