views:

41

answers:

1

Hello I am curious what would be the best way to keep HTML data that won't be displayed at the initial render however will be used for the future. For instance for tabbed navigation, I need to keep all HTML but not sure what would be the way to achieve it.

I can think of:

  • Keep them at some javascript array.
  • Keep them as display:none and redisplay once needed;
+2  A: 

Keeping the html as display:none is usually cleaner. It allows your users to experience the content even if they have javascript turned off, or they are using an alternate device like a screen reader.

Paul McMillan
Screen readers won't read content that is `display: none`, they only read things that are displayed on the screen.
David Dorward
However, some assistive programs have modes that allow users to toggle items which are hidden, for precisely this purpose. The disabled user may not be able to access the content via the normal javascript route.
Paul McMillan