Want to submit data using input in field & pressing “Enter” but not using any button(Data are passing...












0















This question already has an answer here:




  • Enter key press event in JavaScript

    14 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'










share|improve this question















marked as duplicate by Community Nov 24 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.




















    0















    This question already has an answer here:




    • Enter key press event in JavaScript

      14 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'










    share|improve this question















    marked as duplicate by Community Nov 24 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.


















      0












      0








      0








      This question already has an answer here:




      • Enter key press event in JavaScript

        14 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'










      share|improve this question
















      This question already has an answer here:




      • Enter key press event in JavaScript

        14 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

        14 answers








      php codeigniter ascii






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 at 9:01









      Aravind Bhat K

      278214




      278214










      asked Nov 23 at 4:36









      9i8s

      11




      11




      marked as duplicate by Community Nov 24 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 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.


























          1 Answer
          1






          active

          oldest

          votes


















          0














          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
          }





          share|improve this answer




























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            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
            }





            share|improve this answer


























              0














              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
              }





              share|improve this answer
























                0












                0








                0






                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
                }





                share|improve this answer












                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
                }






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 23 at 4:51









                Preeti

                975




                975















                    Popular posts from this blog

                    Contact image not getting when fetch all contact list from iPhone by CNContact

                    count number of partitions of a set with n elements into k subsets

                    A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks