Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Sam Hayward
11,673 PointsJquery adding inline styles?
Hey ^ ^ I'm working on my own site and trying to use Jquery to make a menu for mobile view appear and disappear. For some reason, jquery adds its own inline styles to the menu like 'display:block' Its really weird, does anyone have a clue why? Please help =) thanks
4 Answers

Jeffrey Smith
Courses Plus Student 15,508 PointsIt's being added as inline style because that is one of the most specific types of styling in CSS so it overrides almost anything else.
jQuery will add 'display:block' if you are using the show() method. The show method restores the hidden element back to its initial state— so if you had an element that was initially set to 'display:inline' and then it was hidden, the show() method would have it display inline again.

Nicholas Olsen
Front End Web Development Techdegree Student 19,342 PointsI'm not sure how similar it is to the problem you're experiencing but I had a similar problem when I was working on this menu.
jQuery's animate() function adds inline styles to the menu so I had to use the animate function to reset the inline styles back to what I wanted them to be.
As Josh said, if you have code please post it.

Josh Hicks
14,146 PointsDo you have any code samples?

Sam Hayward
11,673 PointsSorry for the late reply i've been really busy! It was really simple just using .show() and .hide() on a div. Now i realise i wanted .toggle() Just happy that it's something that's supposed to happen Thanks guys =)