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! While you're at it, check out some resources Treehouse students have shared here.

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

JavaScript

Issue selecting elements with JQuery

Instructions:

In the second script tag, write the jQuery code that you'd use to select all elements with the class of 'removable'

I am having trouble with this code challenge. I am not sure what I am suppose to do. Can anyone help me with this one?

Thanks for your help.

Prarthin

11 Answers

Are you kidding me?!? code removed

Really??? I'm glad I stopped to help.

Because answered the question directly, the code was removed....

<sarcasm>sounds reasonable.</sarcasm>

Because my answer of $(".removable"); was removed, the poster potentially lost 16 hours...

I forgot the quotes.

with the second part of your code $("#removable"); you are close.

jQuery selectors work just like CSS selectors. so # = id, and . = class. In this case the challenge is asking for using jQuery to select all elements with the class of removable.

Does that help?

It'll be a hard habit to break. I'm used to answering questions on forums in the most direct way... I look at it like this; the learning material has already been presented. If a member is still struggling, throw them a life preserver and rope, not just a life preserver... but I'll try to honor Treehouse's wishes with respect to the forums...

Thanks Gordon! We meant no disrespect with removing the code snippet you provided. We greatly appreciate everyone, especially those aiming to assist others in learning. Our main objective is to make sure that people are learning and we believe that linking back to videos and discussing the code is the most beneficial way of providing assistance to those who have run into such a road block.

Hi Prarthin,

Can you post the code that you've tried for this code challenge, and the errors you're receiving?

Thanks!

Prarthin Shalin , Are you looking for this?

code removed

Sure, this is the code I tried:

<script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $("#message").hide().show("slow"); $("#removable"); </script>

I don't know what I am doing wrong over here

Yes, it worked.

Thanks for your help Keith.

No problem! Have fun!

Gordon Jiroux , I'm not a moderator or anything, but I saw the below on a previous Forum post, and I'm guessing this is why the code was removed. Your code was a copy/paste answer.

Here on the forum we usually try to give a few hints before giving the answer.

The goal of these forums is not to get a user past a code challenge, instead it's to aid the learning process of our fellow Treehouse users. If you give them the answer, they don't learn much.

Treehouse is more about learning that sticks, as opposed to code snippets.

The copy paste answer is in the video, and obviously it wasn't grasped.... I didn't look up the challenge question the poster was asking about. I answered based question segments "selector" and "class"

I'm not bucking for moderator, I just like to help...

If it were one on one, in person, I would obviously point out the difference between id and class selectors (as you did), but in an effort to save on back and forth on the forum, I elected to go with the simplest approach