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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:46:08+00:00 2026-06-09T09:46:08+00:00

Essentially, I have some code that needs to get the HTML of a parent

  • 0

Essentially, I have some code that needs to get the HTML of a parent element when any of its input elements blur. That’s pretty simple. The problem is that the HTML returned when calling html() on the parent element, does not reflect the current value of the input elements contained within. That is, in Firefox or Chrome. It works in IE of all places.

Here’s the JSFiddle: http://jsfiddle.net/8PJMx/15/

Try changing “world” in the textbox to “everyone” and clicking the button. Note that I’m also appending $.now() so that you can see that the code is in fact executing.

As you can see, $("#parent").html() does not update, even though $("#child").val() does.
For your viewing pleasure, here’s the HTML:

<div id="parent">Hello <input type='text' id="child" value='world' /></div>
<button id="separateEvent">Get HTML.</button>
<br>
<p>The HTML for #parent is:</p>
<textarea id="parentsHtml" style="width:95%; height: 100px;"></textarea>
<p>The value of #child is:</p>
<textarea id="childsValue" style="width:95%; height: 100px;"></textarea>

…and here’s the JavaScript:

$("#separateEvent").click(function ()
                         {
                             $("#parentsHtml").val($("#parent").html() + "\r\n@" + $.now());
                             $("#childsValue").val($("#child").val() + "\r\n@" + $.now());
                         });
  • 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-09T09:46:11+00:00Added an answer on June 9, 2026 at 9:46 am

    The html value="" attribute does not reflect the .value DOM property (unintuitively), but it reflects the .defaultValue DOM property. The .value property is not serialized to HTML, but .defaultValue is.

    User input changes .value, not .defaultValue.

    .value only reflects .defaultValue when the input’s dirty value flag is false

    Here’s a workaround, which also includes an example for SELECT boxes: http://jsfiddle.net/8PJMx/20/

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

Sidebar

Related Questions

So I have what is essentially a spreadsheet in TIFF format. There is some
I have to write an application that is essentially a proxy server to handle
I have some CLOB columns in a database that I need to put Base64
I have several javascript files that during run-time get combined and minified. This is
Okay, so I have a little assignment to do which needs some array of
We have code running JNI in a separate thread. We occasionally get segmentation faults
I have a string that will look something like this: I'm sorry the code
I have this code, what It returns is a list of some clients, but
I have some C source files that need to be pre-processed so that I
So, I essentially have what I want already, very simple, but there are some

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.