Learn

While classes allow us to target multiple elements at once, we can also target single elements by id.

To select by id, we prepend the element’s id name with the # symbol.

$('#someId').hide();

In the example above, we target the #someId element and call the .hide() method on it. The .hide() method hides the someId element when the web page renders to a client’s browser.

Let’s target by id to hide the navigation menu in our MOVE Gear site.

Instructions

1.

Inside our ready callback function in the main.js file, use jQuery to select the #nav-dropdown element.

2.

Call the .hide() method on the '#nav-dropdown' element.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?