Want to submit data using input in field & pressing “Enter” but not using any button(Data are passing...
This question already has an answer here:
Enter key press event in JavaScript
16 answers
<html><input id="test" type="text" /></html>
<script>
$(function(){
$("#test").keypress(function(event)
{
if ((event.charCode == 32) || (event.charCode == 64))
alert("Working with space & @ but not with Enter");
});
});
</script>
Here is my code but it's not working for ascii of 'Enter' which is '13'
php codeigniter ascii
marked as duplicate by Community♦ Nov 24 '18 at 12:20
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Enter key press event in JavaScript
16 answers
<html><input id="test" type="text" /></html>
<script>
$(function(){
$("#test").keypress(function(event)
{
if ((event.charCode == 32) || (event.charCode == 64))
alert("Working with space & @ but not with Enter");
});
});
</script>
Here is my code but it's not working for ascii of 'Enter' which is '13'
php codeigniter ascii
marked as duplicate by Community♦ Nov 24 '18 at 12:20
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Enter key press event in JavaScript
16 answers
<html><input id="test" type="text" /></html>
<script>
$(function(){
$("#test").keypress(function(event)
{
if ((event.charCode == 32) || (event.charCode == 64))
alert("Working with space & @ but not with Enter");
});
});
</script>
Here is my code but it's not working for ascii of 'Enter' which is '13'
php codeigniter ascii
This question already has an answer here:
Enter key press event in JavaScript
16 answers
<html><input id="test" type="text" /></html>
<script>
$(function(){
$("#test").keypress(function(event)
{
if ((event.charCode == 32) || (event.charCode == 64))
alert("Working with space & @ but not with Enter");
});
});
</script>
Here is my code but it's not working for ascii of 'Enter' which is '13'
This question already has an answer here:
Enter key press event in JavaScript
16 answers
php codeigniter ascii
php codeigniter ascii
edited Nov 23 '18 at 9:01
Aravind Bhat K
2741214
2741214
asked Nov 23 '18 at 4:36
9i8s9i8s
11
11
marked as duplicate by Community♦ Nov 24 '18 at 12:20
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Community♦ Nov 24 '18 at 12:20
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can use "event.which" instead of "event.charCode" to get the key pressed.
event.which will return 13 for enter key pressed.
Example:
var code = event.charCode || event.which;
if(code == 13) { //Enter keycode
//Do something
}
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use "event.which" instead of "event.charCode" to get the key pressed.
event.which will return 13 for enter key pressed.
Example:
var code = event.charCode || event.which;
if(code == 13) { //Enter keycode
//Do something
}
add a comment |
You can use "event.which" instead of "event.charCode" to get the key pressed.
event.which will return 13 for enter key pressed.
Example:
var code = event.charCode || event.which;
if(code == 13) { //Enter keycode
//Do something
}
add a comment |
You can use "event.which" instead of "event.charCode" to get the key pressed.
event.which will return 13 for enter key pressed.
Example:
var code = event.charCode || event.which;
if(code == 13) { //Enter keycode
//Do something
}
You can use "event.which" instead of "event.charCode" to get the key pressed.
event.which will return 13 for enter key pressed.
Example:
var code = event.charCode || event.which;
if(code == 13) { //Enter keycode
//Do something
}
answered Nov 23 '18 at 4:51
PreetiPreeti
975
975
add a comment |
add a comment |