I am new to javascript, so my error may be extremely basic. I did look at similar posts and could not figure out what I am doing wrong with my code.
<form name=dform_8190 method="get">
<input type="submit" style="display:none">
<input type="hidden" name=delete_id id="delete_id">
some other code here
<a onclick="if (confirm('Delete Comment 8190?')) {document.getElementById('delete_id').value=8190; document.getElementById('dform_8190').submit();}">
<img SRC="../images/del_x.png" ALT="archive" title="Archive" border="0">
</a>
</form>
the "Delete Comment 8190" box pops up, but when I select "OK", nothing happens.
asked Dec 4, 2019 at 21:00
paul the tutor's tech
31 bronze badge
2 Answers 2
Your form doesn't have an ID of dform_8190. You need to add it. Or change your query to
document.querySelector("form[name=dform_8190]").submit()
answered Dec 4, 2019 at 21:04
Ruan Mendes
92.7k31 gold badges162 silver badges225 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
Try change name to id: . getElementById uses value of "id" attribute.
Comments
lang-js
METHOD="GET"which should beMETHOD="POST"getElementByIdfor aname... That won't work. Change<form name=dform_8190 method="get">==><form id=dform_8190 method="get">