0

Hi All,
i am use the follwing code work fine, how can i make id for each row in table or div id so only row show which i req.

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
	<script type="text/javascript">
		$(function() {
		    $('#toggle3').click(function() {
	$('.toggle3').toggle('slow');
	return false;
});

		});
	</script>
    
    
    </head>
    <body>
    1313
    </body>
</html>



<a href="#" id="toggle3">Animated Toggle</a><br /><br />
<div class="toggle3" style="display:none;">
<table width="200" border="6">
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>

</div>

Please advice how can be do this,,,,,

5
Contributors
6
Replies
25
Views
5 Years
Discussion Span
Last Post by Quique_1
0

thank you for your reply,


make a table where need to hide row with the id or name as need,

0

Is this what you are talking about?

<table>
    <tr id="row1">
        <td>
        </td>
    </tr>
    <tr id="row2">
        <td>
        </td>
    </tr>
    <tr id="row3">
        <td>
        </td>
    </tr>
</table>
<script>
$(function(){
    //hide row1
    $('#row1').hide();

    //hide row2
    $('#row2').hide();
});
</script>
0
<script type="text/javascript">
		$(function() {
		    $('#toggle3').click(function() {
	$('.toggle3').toggle('slow');
	return false;
});
 
		});
	</script>

remove.toggle('slow'); then use .show() and .hide() methods

$('.toogle3').show(500); //500 refers half seconds
0

You can also use some thing like below, give an id to your table like "my_table" so that in case of multiple table s in a page it will affect only specific table. and by using 2,3 you can refer row number #2 and #3 should be hide and #4, #5 means row number #4 and #5 should be display.

 $("#my_table tr:nth-child(2)").hide();
 $("#my_table tr:nth-child(3)").hide();

 $("#my_table tr:nth-child(4)").show();
 $("#my_table tr:nth-child(5)").show();

Call it on click event of any thing and check.

0
$( document ).ready(function() {
       $.each($(".yourclass"), function(){       
           $(this).prevUntil('.yourclass').hide();
      });

      $('.yourclass').click(function(){
        $(this).nextUntil('.yourclass').toggle();
      });
    });



<table>
  <tr class="yourclass">
    <td>rows</td>
    <td>rows</td>
    <td>rows</td>
    <td>rows</td>
  </tr>
</table>

Edited by Quique_1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.