5. JQuery Selectors - Stuck big time


#1


I have no idea what to do at this point (to be honest I've been lost since the lessons fell into HTML/JS linking)

Bottom line is I can't get beyond the first step of excersice 5 - I just don't undestand if it's syntax or if I'm not putting a correct skillset class .

thanks for the help!

https://www.codecademy.com/courses/learn-javascript/lessons/javascript-dom/exercises/jquery-selectors?action=lesson_resume


function main(){
$skillset('.supporting.text');
}
$(document).ready(main);


#2

Hi.

The integration of html/css and javascript is not the easiest of tasks to learn or teach. It looks like you're confusing their example with what you need to write to get it to work.

They say to "write a variable named $skillset. Set $skillset equal to a jQuery selector for the skillset class." So let's break that down step by step.

We'll start with a variable called $skillset:

var $skillset = ???

Next, they say to "Set $skillset equal to a jQuery selector for the skillset class." I can see how that would be vague and confusing in english but it's fairly straight forward in practice and the answer is actually in their "learn" section, just a tad out of context.

What we are doing is setting the $skillset variable to the HTML Element on the page so that we can do stuff with it like show or hide it, etc.

So what's the skillset class?

In css it would be .skillset so we use that in our javascript as well. .skillset is just css until you send it to $() which does jQuery magic for you.

So our result for step 1 is simply:

var $skillset = $('.skillset');

Now, essentially $skillset = <div class='skillset'> which is the wrapper around most things visible on the page.

Hope that helps.

Zach


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.