We've all had to code up those ever-so-fun branching selects. I chose to implement it by showing or hiding (display:block/none) the container of the label+select corresponding to the appropriate branch. And IE6 decided to hemorrhage option innerHTML onto the page - for 1 of the 3 branches: the middle one. I solved it by adding "position:absolute" to the css for the container.
Showing posts with label conditional. Show all posts
Showing posts with label conditional. Show all posts
Wednesday, June 24, 2009
Tuesday, February 26, 2008
If
Have you ever seen code like this?
if(condition){
stuff
}
This won't work for all cases, but I often enjoy writing it like this:
if(!condition) return;
stuff
Note: if you are NOT minifying your code, the bottom method is probably leaner, but if you ARE minifying, stick with the top method.
Subscribe to:
Posts (Atom)