JQuery hide / show not working, I'm doing something wrong

I am trying to show an element (which is a table, but I use it as a div) when the submit button is pressed.

It does not seem to work. And I don’t think that because of the bad CSS karma acquired using tables for the layout.

The code is as follows:

$(document).ready(function() {
    $("#object-created-panel").hide();                      
    $("#create-object-btn").click(
    function() { 
        $("#object-created-panel").show(""); 
        } 
    );      
});

I hope this is enough to show what the error is (if I do not add code for the tables), the identifier of the Submit button: create-object-btn

+5
source share
3 answers

Three steps:

  • Try changing the show ("") to show ()
  • Check the correct operation of the selector, for example. no object id 'object-created-panel'
  • Firebug javascript

http://getfirebug.com/

+3

"return false"; , .

$(document).ready(function() {
    $("#object-created-panel").hide();                                          
    $("#create-object-btn").click(
        function() { 
            $("#object-created-panel").show("");
            return false;
        } 
    );          
});
+2

Why are you using show("")instead show()?

JQuery documentation in show ()

+1
source

All Articles