5. jQuery Selectors


#1

Hi i have a problem error..see from another user that with refresh page pass this lesson..but i can't..is the code correct?


var skillset = document.getElementsByClassName('skillset');

alert(skillset);


#2

Your code is correct, if DOM has element with class="skillset":

<body>
   <div class="skillset">Text</div>
</body>

#3

Please post all of your code.


#4

The upper code found it from another user who said that pass the lesson. As read the instructions i write this code

var skillset =
$('.skillset');

alert(skillset);

had a pop-up window [object Object] but a code error like this

Oops! The test returned an error. Maybe you have a syntax error, or a typo. See full error.

I'm confused.. i have a div class



#5

Are

on the same line?


#6

Try it and at the same line like this

var skillset = $('.skillset');

alert(skillset);

but the same error


#7

The code seems right, maybe it's a bug


#8

Full error

Oops! The test returned an error. Maybe you have a syntax error, or a typo. Hide error.
ReferenceError: main is not defined
at Object.eval (eval at get (main.js:2:1), :1:1)
at Object.get (main.js:2:1)
at Context. (test.js:11:22)
ReferenceError: main is not defined
at Object.eval (eval at get (main.js:2:1), :1:1)
at Object.get (main.js:2:1)
at Context. (test.js:15:22)


#9

I dont get it
I have tried everthing it and it does not pass through
and this is in my main.js:

function main (){
  
};
$(document).ready(main);
var skillset = document.getElementsByClassName('skillset');

alert(skillset);

#10

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