Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4076872
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:28:48+00:00 2026-05-20T17:28:48+00:00

I post a form with $.post on the keyup of a input type=’text’ ,

  • 0

I post a form with $.post on the keyup of a input type='text',
the problem is that after the post, I click anywhere in the browser (even on the firebug console) an the $.post is going to be repeated

live link: http://mrgsp.md:8080/awesome/lookupdemo

(click on a button to open a popup, after search for a letter e.g. ‘m’ after click on something [watch the firebug console] )

my script is something like this:

$('#theform input:text').keyup(function (e) {
        var w = e.which;
        if (w < 9 || w > 45 && w < 91 || w > 93 && w < 112 || w > 185)
            $('#theform').submit();
    });

$('#theform input:hidden').change(function () {
    $('#theform').submit();
});

$('#theform').submit(function(e){
    e.preventDefault(); 
...
 $.post(...);
});

UPDATE: just noticed that without the $('#theform input:hidden').change(... all is ok

UPDATE 2: apparently the textbox also triggers change, strange cuz i registered the change for input:hidden not for input:text

UPDATE 3: solved, it looks like I should have used input[type='hidden'] instead of input:hidden

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:28:49+00:00Added an answer on May 20, 2026 at 5:28 pm

    In some browsers, the change event (only?) fires when the input in question loses focus – that’s why you’re seeing another post when you click elsewhere on the page. See this question for more on that – it’s about radio buttons, but the change/unfocus behaviour is similar.

    And as for why the textbox got bound to the change event: The :hidden selector does a few more things than just selecting inputs with the type hidden. In this case, the text input wasn’t visible on the page when your script ran, so it got selected too (’cause it was hidden!).

    If you only want “true” hidden inputs to be selected, you’ll want the somewhat uglier selector $('#theForm input[type=hidden]').

    Hope this helps!

    PS: Changing the value of an input with JS won’t trigger the change event. Since an input of type hidden is presumably only changeable via JS, you should probably just call $('#theForm').submit() from wherever you change the hidden value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view user control that can post form. This control can be
I have a simple form that I need to submit automatically when text is
Background I'm using POST form submissions instead of links with concatenated arguments inside a
The Setting: The program in question tries to post form data via an AJAX
In handling a form post I have something like public ActionResult Insert() { Order
In an HTML form post what are valid characters for creating a multipart boundary?
I'd like to post some form variables into a classic ASP page. I don't
I'm using jQuery to post a form to a php file, simple script to
I have an action handling a form post, but I want to make sure
I'm trying to make a pull down menu post a form when the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.