Craig Hopson Posted September 17, 2013 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 Link to comment Share on other sites More sharing options...
thescientist Posted September 17, 2013 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();}); Link to comment Share on other sites More sharing options...
Craig Hopson Posted September 17, 2013 Author 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 Link to comment Share on other sites More sharing options...
Craig Hopson Posted September 17, 2013 Author Share Posted September 17, 2013 ok got it just added "display:none" to the cell tags Link to comment Share on other sites More sharing options...
dsonesuk Posted September 17, 2013 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(){ });}); }); Link to comment Share on other sites More sharing options...
thescientist Posted September 17, 2013 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now