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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:29:35+00:00 2026-05-16T22:29:35+00:00

Run this in IE 7,8 or 9. <!DOCTYPE html> <html> <head> <meta charset=utf-8> <title>IE

  • 0

Run this in IE 7,8 or 9.

<!DOCTYPE html>
<html>
<head>
    <meta charset=utf-8>
    <title>IE input value</title>
</head>
<body>
    <form action="">
        <input id="test" type="text" name="username">
    </form>
    <script>
        var input = document.getElementById("test");
        alert(input.value);
        setTimeout(function() {

            alert(input.value);
        }, 2000);
    </script>
</body>
</html>

If you enter a value manually, then hit “refresh”, the first alert is empty, the second alerts whatever you typed, so it seems IE takes a little longer to “auto-populate” the field again.

Question: is anyone else experiencing this and if so: is there a better way than using setTimeout here?

BTW: Firefox alerts what you typed two times (as I would expect).

  • 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-16T22:29:36+00:00Added an answer on May 16, 2026 at 10:29 pm

    Yes, this is known IE behaviour.

    Unfortunately, browsers implement form value memory differently:

    • Mozilla and WebKit replace the HTML value with the remembered value as soon as the element is loaded into the document;
    • IE replaces the value when the document content is completely loaded;
    • Opera replaces the value just after document content is loaded, possibly after the load event fires on window.

    (There are also browser differences about under what circumstances a reload causes form fields to be remembered, and browsers with bfcache will cause field memory to happen less as more back/forward navigations bypass page reloading.)

    Aggravatingly, that means if you want to write a script that checks form values and updates page content dependent on them reliably, you have to schedule a 0-delay timeout from window.onload—and, if you want it to react faster than onload, before that too (eg. straight away and/or on a poller).

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

Sidebar

Related Questions

My webpage code is this: <!DOCTYPE html> <html> <head> <meta charset=utf-8 /> <title>index</title> </head>
Here is a simple page: <!DOCTYPE HTML> <html lang=en> <head> <meta charset=UTF-8> <title>Test page</title>
I have this code http://plnkr.co/edit/kiH0Ge?p=preview <!doctype html> <html ng-app=plunker > <head> <meta charset=utf-8> <title>AngularJS
I have a page that looks like this.. <!DOCTYPE html> <html> <head> <title>JQM</title> <meta
Here is my html code: <!DOCTYPE html> <!-- test app --> <html> <head> <title>jQuery
This is the code: <!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd> <html> <head>
<!-- <!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd> --> <html> <head> <meta http-equiv=Content-Type
I was wondering what will happen if I run this code: <!DOCTYPE html> <html
I run this code here <html> <script type=text/javascript src=lib/jquery-ui-1.8.21.custom.min.js></script> <script src=http://127.0.0.1:5984/_utils/script/jquery.couch.js></script> <!--<script type=text/javascript src=lib/jquery-1.7.2.js></script>-->
I'm trying to run this code using tomcat in eclipse <%@ page language=java contentType=text/html;

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.