Anyone can teach me how to make input button onlick when press the keyboard "Enter" ?
What i have study from web is something like this , but it's does't work when i press enter from keyboard . Anyone can show me how ??
<input type="text" id="info" name="info" />
<input type="button" id="bn" name="bn" value="click" onclick="read()" />
<script>
$(document).ready(function(){
$('#info').keypress(function(e){
if(e.keyCode==13)
$('#bn').click();
});
});
function read()
{
// do smth
}
</script>
I am adding fiddle : http://jsfiddle.net/nzu27rw4/1/ make sure that you have added jquery reference on the top of this script