Result of expression ‘document.forms[0].submit’ [[object HTMLInputElement]] is not a function.
191
post-template-default,single,single-post,postid-191,single-format-standard,bridge-core-3.0.1,qodef-qi--no-touch,qi-addons-for-elementor-1.5.3,qode-page-transition-enabled,ajax_updown,page_not_loaded,,vertical_menu_enabled,side_area_uncovered_from_content,qode-theme-ver-28.7,qode-theme-bridge,disabled_footer_top,qode_header_in_grid,wpb-js-composer js-comp-ver-6.8.0,vc_responsive,elementor-default,elementor-kit-6

Result of expression ‘document.forms[0].submit’ [[object HTMLInputElement]] is not a function.

Result of expression ‘document.forms[0].submit’ [[object HTMLInputElement]] is not a function.

I was trying to add a small delay into my form submission like so:

<form ... onsubmit="setTimeout('document.forms[0].submit()',2000);return false;">

but everytime I tried it, I got the following error:

Result of expression 'document.forms[0].submit' [[object HTMLInputElement]] is not a function.

This one had me stumped, until I realized what it was telling me… that my submit button was named “submit”.

<input type="submit" name="submit" id="Button1" />

I changed the name of the submit button and the problem went away.

<input type="submit" name="button1" id="Button1" />

Basically, Javascript provides a “convenience” by adding the names of the form inputs as children of the form. But this then clashes with preset function names, like the submit() function.

Tags:


Mastodon