jQuery hide/show Safari Bug

March 17th, 2008

I’ve noticed problems in Safari with the hide/show methods of jQuery on and off for quite a while now. Basically they don’t work. Correct me if i’m wrong. This behaviour also extends to the fadeIn/Out methods.

The problem can be circumvented to applying css rules directly to the element(s) in question.

// This will fail in Safari
$(element).hide()
// But this will work
$(element).css('display','none')

A quick google reveals that lot’s of people have come across this same issue, but no definitive answers.

Posted in Web | Tagged with: ,

3 Responses

  1. Jamie

    Update: Ticket opened here http://dev.jquery.com/ticket/3038

  2. Gozzy

    I came experienced this error too after an animate where i get the element through the animate callback.
    el.hide(), el.css(’display’, ‘none’) and el.style.display = ‘none’;
    did not work in safari or firefox

    I fixed it using el.fadeOut(0) there still is a fadeOut in firefox and safari but it works without removing the text (.empty() works without an delay but causes you to lose your data.)

  3. Sean

    This fixed my problem when the element I was attempting to show and/or hide was already hidden by its parent.

    Thanks for the tip.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.