Bonsai - what does it do?


I don’t understand the point of this task. I can add a url and text without adding any jquery. I don’t find the explanation very helpful. Is there a point to this. What does the code do?


Hi @gennie_cooperhotmail,

Yes, jQuery isn’t actually necessary for any of these projects. jQuery doesn’t give JavaScript extra functionality, only makes it easier to use JS in certain ways. The projects will get harder as you go on, but for many people new to jQuery this is a good starting point.


Thanks for your reply. Maybe I should rephrase my question. I can’t actually see any difference when I add my jquery. I’ve copied other people’s code from here and I can’t tell what has changed.


@gennie_cooperhotmail jQuery won’t change the looks, only the functionality. Are you unable to tell why your code and someone else’s different code work? There are multiple ways of doing the same thing.

Also, make sure you’ve taken the rest of the course before doing these projects, since they guide you on that assumption.

Do you have a question about a specific piece of code I’d be able to help you with?


I still don’t understand what the outcome should be. What is the keyup function meant to do? How does it amend the meme generator? Why would it be needed?


@gennie_cooperhotmail I strongly recommend you take the JavaScript course if you haven’t already. It will help you understand the answers to these questions better.

What is the keyup function meant to do?

When you press a key on your keyboard, it goes down, then up. The keydown() event listener will trigger if you only press the key down, but the keyup() listener triggers when the key is let up. There’s also keypress(), which is similar to keyup().

How does it amend the meme generator?

Every time you let a key up, it runs the code inside the event listener. It only does what you tell it to, and you’re telling it to replace the text with some new text.

Why would it be needed?

Without listening for a keypress of some sort, you won’t know when to update the text.