I have this function defined in my in my JSP:
function addcolor(){
alert("found " + document.getElementById("clrCd").value);
}
my HTML (from struts 1.3 app)
<input type="text" name="clrCd" maxlength="2" size="2" value="">
<input type="button" name="add" value="ADD" onclick="addcolor()">
when my browser is in quirks mode, and I click the ADD button, I get the alert with the value of the text input
if I put my browser into IE8 standards mode (via F12 console) and run the same code, I get:
Error: Unable to get value of the property 'value': object is null or undefined
why on earth is this happening....I've lost an entire day to dealing with IE and all it's bullshit.
this is a legacy app and I can't really change much, but I'd really like to get them off quirks mode so we can start using some HTML5 features like bootstrap and angularJS.
any ideas?
Jason
This isn't "IE bullshit", it's that you don't have an element with any id clrCd
. You've only set the name attribute.
Add an id="clrCd"
to your element, and you will have more luck.