Hide problem

Hide problem

I'm having a problem with the hide function in jquery. My markup code is very straight forward and looks like this...

  1. <div id="taskEditorContainer" class="hide">
  2.       Some content
  3. </div>
  4. <button id="taskEditorTool" class="button" type="button">Skapa ärende</button>

The hide css class is simply to ensure that the div is hidden when the page loads...

  1. div.hide
  2. {
  3. display:none;
  4. }

The jquery code looks like this...

  1. $(function() {
  2. $('button#taskEditorTool').live('click', function() {
  3. if ($('#taskEditorContainer').is(':visible')) {
  4. $('div#taskEditorContainer').hide(400);
  5. } else {
  6. $('div#taskEditorContainer').show(400);
  7. }
  8. });
  9. });

Showing the div works fine, hiding the div on the other hand doesn't. For some reason if I do it like this...

  1. $('div#taskEditorContainer').hide();

... it works just fine, but is rather ugly. On the other hand this...

  1. $('div#taskEditorContainer').hide(400);

... won't work at all. I've tried using 'fast' and 'slow' as well, when ever I specify a speed indicator to the hide function it won't work. Anyone else experienced this?