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

    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'










share|improve this 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.























    0
















    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'










    share|improve this 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.





















      0












      0








      0









      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'










      share|improve this question

















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      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.


























          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 '18 at 4:51









                PreetiPreeti

                975




                975

















                    Popular posts from this blog

                    Create new schema in PostgreSQL using DBeaver

                    Deepest pit of an array with Javascript: test on Codility

                    Costa Masnaga