August 6, 201114 yr I am trying to manipulate a table with Jquery - hiding certain rows upon a button click. The table itself has 6 different class values. One class will always be displayed. I want to be able to hide any or all of the other 5 classes, and any combinations of them. I need a separate labeled button for each class. The tutorials I have found (such as this one: http://www.w3schools...uery_hide_class) all show examples of 1 button, which I have been able to make work on my table. But I am unable to add any other buttons - I can't figure out how to distinguish between different buttons. I have tried name and id with no success. An example that isn't working: <input type='submit' name='hideP' id='hideP' value='Pop Culture' /> $("hideP").click(function(){ $(".P").hide(2000); }); How do I have more than one button in Jquery? PvP is not for meIn the 3rd Year of the BoycottReal-world money saved since FT/W: Hundreds of DollarsReal-world time saved since FT/W: Thousands of Hours
August 6, 201114 yr http://www.w3schools.com/jquery/jquery_syntax.asp jQuery Syntax Examples $(this).hide()Demonstrates the jQuery hide() method, hiding the current HTML element. $("#test").hide()Demonstrates the jQuery hide() method, hiding the element with id="test". $("p").hide()Demonstrates the jQuery hide() method, hiding all <p> elements. $(".test").hide()Demonstrates the jQuery hide() method, hiding all elements with class="test". eg: <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready( function() { $(".btest").click( function() { $(".test").hide(); }); $(".btest2").click( function() { $(".test").show(); }); $("#btest3").click( function() { $(".test").hide(); }); $("#btest4").click( function() { $(".test").show(); }); }); </script> </head> <body> <h2 class="test">This is a heading</h2> <p class="test">This is a paragraph.</p> <p>This is another paragraph.</p> <button class="btest">hide(class)</button> <button class="btest2">show(class)</button> <button id="btest3">hide(id)</button> <button id="btest4">show(id)</button> </body> </html>
August 6, 201114 yr Author Thanks. That turned on the light. PvP is not for meIn the 3rd Year of the BoycottReal-world money saved since FT/W: Hundreds of DollarsReal-world time saved since FT/W: Thousands of Hours
August 6, 201114 yr I linked the wrong section, but you get the idea. http://www.w3schools.com/jquery/jquery_selectors.asp
Create an account or sign in to comment