Help with Twitch Streamers


#1

Hi everyone! I need help!
I did this exercise, but when I click on nav menu, my jQuery doesn’t work. I want to filter theses channels for status online, offline and all.
I don’t know if there is a channel online too! :slight_smile:
Someone can help-me? Thanks a lot!


#2

You have an extra apostrophe in your selector which is preventing your code from running:

  $('.action a'').on('click', function(e) {

Change it to:

  $('.action a').on('click', function(e) {

Once you get that part working, add a `console.log(y)` to see why the code inside your if statement isn't running: ```js $('.action a').on('click', function(e) { y = $(this).text(); console.log(y); ``` Once you get past that part, look at all of your elements, and notice that they are all using the same "offline" class. You are running into a problem by using a for() loop with an asynchronous function. It's best to use a .forEach loop instead. Refer to this Stack Overflow for some more background: https://stackoverflow.com/questions/13343340/calling-an-asynchronous-function-within-a-for-loop-in-javascript

#3

Thanks a lot!
I did these mofifications but my code doesn’t work.

The jquery doesn’t work after method append, I don’t know why?


#4

Your .append() method seems to be appending HTML just fine now. What do you mean that it isn’t working?


#5

When I click on “online” in nav menu, the jQuery doesn’t work.
I want to do “offline” disapear when I to click on online menu option.

Sorry about my English :slight_smile:


#6

Check what your console.log says when you click “online” and compare it to what you are checking in your if() statement. It’s a small error - but you’ll be able to debug it if you look closely at the output in your console.


#7

Thanks a lot, now it’s working.
It was a space before the text :slight_smile:
O my god, I lost much time whith it!


#8

I couldn’t give away the answer so easily - glad you got it figured out! :slight_smile: