Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

106
Views
How to pass parameters on "Press Enter" jquery php

I am workig with jquery and php,I have input type textbox and i want to execute function by "onclick" OR "Press Enter button" But problem is ...i am trying to pass parameters (via data attributes) to anoter function then nothing works,Here is my code

 <input type="text" id="txt" class="feed_in_input fi1" name="">

Here is my script

$('.fi1').keypress(function(e) {
    if (e.which == 13) {
     e.preventDefault();
      handleClickAndEnter(e);
    }
  });

$('.feed_reply_smiley').on('click', function(e) {
    handleClickAndEnter(e)
});


function handleClickAndEnter(e) 
    {
        var txt_id = $(this).attr('id').replace('button', 'txt');
        var vals = $('#'+txt_id).val();
        var pst=$(this).data('pst');
        var cst=$(this).data('cst');
        var pidd=$(this).data('pidd');
        alert(txt_id + vals);

        .....ajax code
        ....
    }

If i just use "onclick" function then all parameters passing properly but i want to pass parameters in both condition ("onclick" or "Press enter button") How can i do this ? Where i am wrong ? Thanks in advance

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!