i want a feature then when user fill username and goes for fill the password then if he click ENTER then form is automatically submit how i can do this in html
+1
A:
http://www.htmlcodetutorial.com/forms/index_famsupp_157.html
this probably would help ;)
Saikios
2010-07-24 08:20:54
+3
A:
You need javascript for that:
var el = document.getElementById('field_id');
el.onkeypress = function(event){
var key = event.keycode || event.which;
if (key === 13) {
document.FormName.submit();
}
};
jQuery: (based on comment)
$(function(){
$('#form_id:input').keypress(function(event){
var key = event.keycode || event.which;
if (key === 13) {
$(this).parents('form').submit();
}
});
});
Sarfraz
2010-07-24 08:22:49
@ sarfaraz are you convert it to jquery
steven spielberg
2010-07-24 08:34:10
@steven spielberg: See my updated answer please.
Sarfraz
2010-07-24 08:41:04
+1
A:
Example-
<FORM action="..." method="post">
<P>
<LABEL for="fuser" accesskey="U">
User Name
</LABEL>
<INPUT type="text" name="user" id="fuser">
</P>
</FORM>
See details HERE