Internet Explorer and elements named "description"
OK I'm not entirely sure why I've never come across this before but it's a classic "Internet Ignorer" bug...
When doing Javascript validation on a form recently we had a field named (& id'ed) "description"
<textarea name="description" id="description"></textarea>
Subsequently we attempted to validate the value of this field in JavaScript...
if(document.getElementById("description").value!=""){...}
Well it turns out that this returns the meta description tag for Internet Ignorer ("undefined" for the value)... Marvellous! Well there is a workaround, either rename your field or, simply override the nativeGetElementById method for Internet Ignorer... Check out Sixteen Small Stones
When doing Javascript validation on a form recently we had a field named (& id'ed) "description"
<textarea name="description" id="description"></textarea>
Subsequently we attempted to validate the value of this field in JavaScript...
if(document.getElementById("description").value!=""){...}
Well it turns out that this returns the meta description tag for Internet Ignorer ("undefined" for the value)... Marvellous! Well there is a workaround, either rename your field or, simply override the nativeGetElementById method for Internet Ignorer... Check out Sixteen Small Stones
Labels: bug, description, getElementById, internet explorer, javascript





0 Comments:
Post a Comment
<< Home