I want JavaScript to click a button when a parameter is in the url (&startCalc=1).
html:
<input name="startCalc" value="Start" type="submit">
javascript:
var parameterExists = url.searchParams.get("startCalc");
if(typeof parameterExists !== 'undefined' && parameterExists == 1) {
document.getElementsByName('startCalc').click();
}
I get an error: "click is not a function". I want to simulate a click the same way as an user would would do it when clicking on that button...