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

  • Home
  • SEARCH
  • 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 3228776
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:43:58+00:00 2026-05-17T16:43:58+00:00

For each enter or for every entry into the text box I want the

  • 0

For each enter or for every entry into the text box I want the alert to be triggered

<input type="text" id="val_xml" class="val_xml1" maxlength="3" size="2"/>


$('#val_xml').bind('change',function() {
    var v = $('#val_xml').val();
    alert(v);
});

Thanks
Jean

  • 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-17T16:43:59+00:00Added an answer on May 17, 2026 at 4:43 pm

    Your code seems to work.

    Make sure to include a doc ready / Script tags, etc. And if you want an automatic alert once the maximum number of characters are entered:

    ​$(function() {
        $('#val_xml').bind('change',function() {            
            alert(this.value);
    
            // These alerts can get annoying. If you are done with it, unbind it:
            // $(this).unbind(arguments[0]); // <== would unbind this alert
         });
    
          // Check if max chars entered at each keyup
        $(document).keyup(function() {
            var $valXML = $("#val_xml");
            if ($valXML.val().length >= $valXML.attr("maxlength") )
                $valXML.trigger("change");
        });
    });​
    

    Try it out with this jsFiddle

    The above does one alert for each “entry”. This means that the alert is triggered by blurring, by pressing enter, or when 3 chars (the max) are entered.

    Note that each time you write $('#val_xml') you create a new jQuery object. So in your code, you create the exact same jQuery object twice. Additionally, there’s no need to use a jQuery method to access the value property of a DOM element, which is why I use this.value.

    References:
    .attr()
    .keyup()
    .trigger()

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

Sidebar

Related Questions

I want add a key up event to every text box element in a
Each of my clients can have many todo items and every todo item has
Each client is identified by a hash, passed along with every request to the
Should each class in my C# project get its own file (in your opinion)?
Lets say I have a food model in the model, every day, people enter
Hii everyone! I have some text fields in each cell of the table view,
Each time a python file is imported that contains a large quantity of static
Each year at Thanksgiving, my family has drawn names out of a hat to
Each page of my site has 10 (almost) identical divs, varying only in the
Each of these variables has an integer value. But this syntax is not valid

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.