Skip to content Skip to sidebar Skip to footer

Innerhtml Not Being Updated After Changing Value Of Input (checked = True/false/"checked")

Brief: I need to grab the information in parentElement, but I need the input information updated. when I am grabbing the innerHTML of parentElement, after the box is unchecked, i

Solution 1:

The state of checkboxes and the value of input boxes are NOT a part of the source HTML.

For proof of this, try putting a textbox on a page with value="old", change the value, then compare element.getAttribute("value") and element.value - they're not the same.

You really should save the state of the form, rather than the HTML behind it.

Solution 2:

This is happening because element.childNodes[0].checked = false; is setting the DOM property, which is a separate entity than the HTML attributes.

Your checkit function should also be interrogating the DOM property, not checking the innerHTML.

See this question for more information about DOM properties and HTML attributes.

Post a Comment for "Innerhtml Not Being Updated After Changing Value Of Input (checked = True/false/"checked")"