Submit form without having submit button ?

By November 4, 2011 JavaScript

Here is an example,how to avoid submit button to submit the form.here we have used jQuery form submit method.
<html>
<head>
<title>Submit form without having submit button</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("a#submit").click(function(){
$("#target").submit();
});
});
</script>

</head>

<body>
<form method="post" id="target" action="test.php">
What's your ice cream flavor ?
<input type="text" name="flavor" />
<a href="#" id="submit">Submit</a>
</form>

</body>

</html>

Leave a Reply

− 1 = 1