Search code examples
jqueryslidetoggle

jQuery - Slidetoggle works but not in Firefox


<script>
jQuery(document).ready(function($){
$("#panel").click(function(){ 

event.preventDefault();
$("#panel_stats").slideToggle("slow");

});
});
</script>

I can confirm that this works in Chrome and Safari but somehow not in Internet Explorer and Firefox. I've already read somewhere that having a inline HTML "display:none" would work but in the end it didn't.

Removing event.preventDefault(); did the trick, thank you all !


Solution

  • <script>
    $(document).ready(function(){
        $("#panel").click(function(){ 
           $("#panel_stats").slideToggle("slow");    
        });
    });
    </script>
    

    Try removing event.preventDefault(); also define panel to #panel or .panel

    DEMO: http://jsfiddle.net/enve/L4nXy/