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 8439599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:02:29+00:00 2026-06-10T08:02:29+00:00

//show city/state on input maxlength $(input#billZipCode).live(keyup, function( event ){ if(this.value.length == this.getAttribute(‘maxlength’)) { if(!$(this).data(‘triggered’))

  • 0
//show city/state on input maxlength
$("input#billZipCode").live("keyup", function( event ){

    if(this.value.length == this.getAttribute('maxlength')) {
        if(!$(this).data('triggered')) {
            // set the 'triggered' data attribute to true
            $(this).data('triggered', true); 
            if ($(this).valid() == true ) { zipLookup(this, "USA"); } 
        }
    } else {
    $(this).data('triggered', false);
    }

});

the function zipLookup performs an ajax call and populates the fields.

The above works for when a user keys in zipcodes – however, if a user puts in a zipcode and then pastes (CTRL V) a new zipcode value, the function doesn’t fire again.

  • 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-06-10T08:02:30+00:00Added an answer on June 10, 2026 at 8:02 am

    You may catch the paste event :

    $(document).on('change keyup paste', '#billZipCode', function(){
       // do something
    });​​​​​​
    

    Reference on the onpaste callback used by jquery : https://developer.mozilla.org/en-US/docs/DOM/element.onpaste

    Note that, as specified in the documentation, this doesn’t work on IE8 : you have to attach the paste event directly to the element :

    In Internet Explorer 8 and lower, the paste and reset events do not
    bubble. Such events are not supported for use with delegation, but
    they can be used when the event handler is directly attached to the
    element generating the event.

    Side notes :

    • use “#billZipCode” and not “input#billZipCode”
    • use on, not live (which is deprecated)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my table , use tr, and td. NAME Address CITY STATE ABC
When user select United States I show textbox for US city but what if
Android application should show Events happening in city as per day/month/year anywhere in the
This .show and .hide works great in Firefox 3 but not in IE 7.
I have a column of strings with a city, state and number in each.
I have two table like this: table1_ride -------- id ride id from_which_city city id
i'm trying to create a multilevel list. I have two tables 'State' and 'City'.
Using Codeigniter, I have a controller function name search that takes in parameters state
The following validation code in the model: validates :formatted_address, :zip, :city, :state, :country, :presence
I'm developing a search form with a button that adds up to 4 State/City

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.