Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery hide/show doesn't seem to work - am I doing something wrong

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

It doesn't seem to work. And I don't think that's because of bad CSS Karma acquired by using tables for layout.

Code is as follows:

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

Hopefully that is enough code to show what the error is (if not I will put in the code for the tables as well) the Submit button's id is: create-object-btn

like image 234
Ankur Avatar asked Sep 08 '09 14:09

Ankur


1 Answers

Three steps:

  1. Try to change show("") to show()
  2. Check the selector work correct e.g. no object id 'object-created-panel'
  3. Use Firebug to detect the javascript error

http://getfirebug.com/

like image 67
Jirapong Avatar answered Oct 14 '22 03:10

Jirapong