August 28, 201313 yr Hello, i am echoing out some data from a database and need to close / hide part of it. An example of this is:From the database i am echoing out a div called 'commentsbox' In my header i have a button that will close / open all of the divs with the same class name. I have this: http://jsfiddle.net/aJc2B/Can anyone modify it to work?
August 28, 201313 yr Hi LovelockThe Jquery 'live' method has been depreciated since v1.7. Use 'on' instead and your code will work. your code: jQuery(document).ready(function(){ jQuery('#hideshow').on('click', function(event) { jQuery('.commentsbox').toggle('show'); }); });
August 29, 201313 yr This will work for you $(document).ready(function(){ $("#hideshow").click(function() { $(".commentsbox").toggle('show'); }); }); make sure your using the latest version of Jquery as well Edited August 29, 201313 yr by webdesigner93
Create an account or sign in to comment