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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:08:05+00:00 2026-05-28T22:08:05+00:00

I’m looking to get the value of this input if it changes. I have

  • 0

I’m looking to get the value of this input if it changes. I have a map.swf that makes the value change depending on what the user selects in the .swf, so I was wondering how to get this done.

<a href="map.php" onclick='return GB_showCenter("",this.href,380,780);' class="page">See Map</a>
<input name="sector_e" type="text" id="sector_e" value="Please click The Map" size="1" readonly>

This jQuery only alerts me if I press a key, I want it to alert if the value changes without any event.

$('#sector_e').bind("keyup", function() {    
    alert($(this).val());
});
  • 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-28T22:08:06+00:00Added an answer on May 28, 2026 at 10:08 pm

    You will need to do a combination of things:

    1. Use jQuery’s data command capabilities to save the initial value.
    2. Use the jQuery’s focusout or blur or change event to check the current value against what is saved using data.

    Which even you choose depends on whether or not direct user-interaction is possible or not. Further processing can happen once you detect a change.

    FOR EXAMPLE:
    You might consider marking the element with a class name like “isDirty” using jQuery’s addClass command.

    Then you could do things like:

    $('.isDirty')
    

    In the meantime…

    HERE IS A CODE SAMPLE USING FOCUSOUT:

    <script type="text/javascript">
        $(document).ready(function () {
            var txtSectorE = $('#sector_e');
    
            // Save the initial value
            $.data(txtSectorE, "last", txtSectorE.val());
    
            // Setup the event
            txtSectorE.focusout(function () {
                var last = $.data(txtSectorE, "last");
                if (last != $(this).val())
                    alert("changed");
            });
        });
    </script>
    
    <input id="sector_e" name="sector_e" type="text" value="Please click The Map">
    

    Of course, doing it this way is taxing as you would have to write a separate set of calls for each textbox.

    So, why not add a class name to each textbox and do it this way…

    A BETTER EXAMPLE USING FOCUSOUT:

        <script type="text/javascript">
            $(document).ready(function () {
                var txtSectors = $('.sector');
    
                $.each(txtSectors, function (index, textbox) {
    
                    // Save the initial value
                    $.data(textbox, "last", textbox.val());
    
                    // Setup the event
                    textbox.focusout(function () {
                        var element = $(this);
                        var last = $.data(element, "last");
                        if (last != element.val())
                            alert("changed");
                    });
                });
            });
        </script>
    
    <input id="sector_a" type="text" class="sector" value="Something">
    <input id="sector_b" type="text" class="sector" value="Another">
    <input id="sector_c" type="text" class="sector" value="Yet Again">
    <input id="sector_d" type="text" class="sector" value="Wow This Arduous">
    <input id="sector_e" type="text" class="sector" value="Getting Tired Of Typing">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I need to clean up various Word 'smart' characters in user input, including but
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.