Craig Hopson 7 Posted September 17, 2013 Report Share Posted September 17, 2013 Hi guys using this code to hide table contents but how can i make the table hidden on page load $('.header').click(function () { var $this = $(this); $(this).nextUntil('tr.header').slideToggle(100).promise().done(function () { $this.find('span').text(function (_, value) { return value == '-' ? '+' : '-' }); });}); http://jsfiddle.net/y4Mdy/ Thanks Quote Link to post Share on other sites
thescientist 231 Posted September 17, 2013 Report Share Posted September 17, 2013 what have you tried? this seems like a very trivial thing, I'm sure there would be plenty of google searches for this... https://www.google.com/search?q=hide+element+on+page+load+jquery&oq=hide+element+on+page+load+jquery&aqs=chrome..69i57j0l3.6532j0&sourceid=chrome&ie=UTF-8 $(document).ready(function(){ $('.table-selector-here').hide();}); Quote Link to post Share on other sites
Craig Hopson 7 Posted September 17, 2013 Author Report Share Posted September 17, 2013 Thanks for the reply but that does'nt work with my code i dont need to hid a div just the table cells Quote Link to post Share on other sites
Craig Hopson 7 Posted September 17, 2013 Author Report Share Posted September 17, 2013 ok got it just added "display:none" to the cell tags Quote Link to post Share on other sites
dsonesuk 913 Posted September 17, 2013 Report Share Posted September 17, 2013 $(function(){ $('.header').nextUntil('tr.header').hide(); $('.header').find('span').html('+');$('.header').click(function(){ $(this).find('span').text(function(_, value){return value=='-'?'+':'-'}); $(this).nextUntil('tr.header').slideToggle(100, function(){ });}); }); Quote Link to post Share on other sites
thescientist 231 Posted September 17, 2013 Report Share Posted September 17, 2013 (edited) Thanks for the reply but that does'nt work with my code i dont need to hid a div just the table cells ah, ok. that really wasn't clear from your original post though. Hi guys using this code to hide table contents but how can i make the table hidden on page load Edited September 17, 2013 by thescientist Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.