ailon's DevBlog: Development related stuff in my life

Naming HTML Objects: Use Some Imagination

5/16/2008 9:48:47 AM

While answering questions about strange issues with SPAW Editor I notice that people often give name/id to their html objects like "body" or "text" or something like this. And this works for them until they try doing some manipulations with these objects using JavaScript. And then crazy things happen randomly.

I don't know if this is officially forbidden somewhere. But it's always a good idea to think twice every time you get an urge to name your textarea holding your post body just "body". "postBody" is only 4 keypresses longer but it will save your hours later when you sit irritated, scratching your head, trying to figure out why a simple javascript doesn't work or produces crazy side-effects.

kick it on DotNetKicks.com

Tags: ,

blog comments powered by Disqus
Copyright © 2003 - 2014 Alan Mendelevich
Powered by BlogEngine.NET 2.5.0.6