You should probably use style.display = "none" instead, see http://stackoverflow.com/questions/133051/what-is-the-difference-between-visibilityhidden-and-displaynone .