This.form.submit() Not Working After Clicking Div Element In Form November 15, 2024 Post a Comment I was trying to test form submission using mouse clicks but the form doesn't seem to submit with vanilla javascript. I'm using this simple markup and code: Solution 1: A div is not a form element. There is no this.form for it.You can still do document.forms.form.submit() (.form since you have name="form")Solution 2: Your code might work if you tried something like this: onClick="document.forms["price"].submit();"Copythis in your case actually refers to the div tag, not the document object which contains the reference to the form itself.Solution 3: Use following code if your form name is "filter-form"Baca JugaCheck Atleast One Checkbox Is Checked On Form SubmissionDocument.form.submit(); Won't Submit In SafariHow To Change Background Image Dynamically Only When Radio Button Is Selected And By Pressing Submit Buttononclick="return document.forms.filter-form.submit();"CopySolution 4: A div isn't a form element (thus no .form property) nor has it a value. I think you wanted <input> instead of <div>.Solution 5: This is an older question, but this should work onclick="this.parentNode.form.submit()"Copy Share You may like these postsOnclick() Not Working In SafariAdd More Behavior To Existing Onclick Attribute In JavascriptBody Onclick Go To TextareaJavascript Copy Text To Clipboard Without Click Any Button On Page Load Post a Comment for "This.form.submit() Not Working After Clicking Div Element In Form"
Post a Comment for "This.form.submit() Not Working After Clicking Div Element In Form"