• Client login
  • Work for us

All the latest from the team...

Tuesday, 16 September 2008

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

Labels: , , , ,

0 Comments:

Post a Comment

<< Home

RSS feed ATOM feed Add to Technorati Favorites View Jon Harvey's profile on LinkedIn