Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
How to submit a form using JavaScript by clicking a link?
Home
JavaScript
How to submit a form using JavaScript by clicking a link?
0
votes
asked
Jun 9, 2022
in
JavaScript
by
sharadyadav1986
How to submit a form using JavaScript by clicking a link?
form-submission
javascript
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Jun 9, 2022
by
sharadyadav1986
Let's see the JavaScript code to submit the form by clicking the link.
<
form
name
=
"myform"
action
=
"index.php"
>
Search:
<
input
type
=
'text'
name
=
'query'
/>
<
a
href
=
"javascript: submitform()"
>
Search
</
a
>
</
form
>
<
script
type
=
"text/javascript"
>
function submitform()
{
document.myform.submit();
}
</
script
>
...