tags:

views:

44

answers:

3

I am using this code to display a grid

$('#table1 tr').bind('click', shows);

function shows() {
    $('#table').show();
}

Where #table is the following HTML fragment:

<div id="table">
  <p>shiva</p>
</div>

I am not able to show shiva? is this right what I am doing here?

thanks

+1  A: 
$("#table1 tr").click(function(){
   $('#table').show();
});
Jon
but my second table its not showing the data?
kumar
Do you have a style on the paragraph tag inside of table making it invisible or are you calling hide() on it earlier in your code?
Jon
No I dont have any thing inside that... I am not calling any hide() too. but second div is not displaying grid..corect me if I am wrong pleas.. my intesion is i have two jquery grid funcation in ascx control..on first grid I got the user data.. on clicking user data row I need to dispaly other grid below that?how do I need to arrange the div tags for that?thanksthanks
kumar
<button>Show it</button> <p style="display: none">Hello 2</p> <script type="text/jscript"> $("button").click(function() { $('p').show(); }); </script>
kumar
put a semi colon after display:none
Jon
A: 

You may be running into a situation where "shows" is not yet defined, so you're effectively binding the click handler to a null function. (Your context may cause this to be different, though.)

So, you could do as Jon suggested and put the function inside the click handler binding call. Or, you could move the shows function declaration above the click handler binding.

You could also be in a situation where some CSS styling is causing your "table" div to be invisible no matter what the "display" value is set to. (This could be margins, height, width, color, font-size, etc.)

John Fisher
Thanks,I did this way,$("#table1 tr").click(function(){ $('#table').show();});but my second div tag I am not seeing..my div tab is something like this.. <div id="A" class="tab"> <table id="AA"></table> <div id="Foote"></div> <script type="text/javascript"> //Calling first grid method </script> <div id="table2"> <table id="BB"></table> <div id="footer"></div> </div>i am not able to display table2 using that show(); on click on first grid row displaying second gri
kumar
Even I used Simple exaple to show the Hello 2 but its not displaying there.. <button>Show it</button> <p style="display: none">Hello 2</p> <script type="text/jscript"> $("button").click(function() { $('p').show(); }); </script>
kumar
A: 

Ok you're not explaining yourself very well but this is what i'm interpreting:

<!-- HTML -->
<div id="grid1">... some html ie. tables etc</div>
<div id="grid2">... some more html</div>

You want grid2 to be hidden by default and shown once grid1 is clicked.

/*CSS*/  
#grid2{display:none;}

/*Javascript*/
$("#grid1").click(function(){
  $("#grid2").show();
});
brad