Problem with my code on jQuery

Hello guys, I’m having a bit of a problem with my code. This code: ("menu-toggle").click(function (e) {e.preventDefault(); ("#wrapper). toggleClass(“toggled”). I got the code from codeplay (it’s a side drawer with a button for toggle). Can someone explain the code to me because I don’t write jQuery. Also will the question be clearer if I uploaded a photo?

When the menu toggle is clicked the wrapper class list will have the class “toggled” added if it doesn’t have it, or removed if it’s already there.

Hello and thanks for the Information. I’m using angular frame work and despite the code(which looks correct) it doesn’t do the needful when it’s clicked. I have searched for the reason but haven’t gotten any

Without seeing the implementation it’s pretty hard to help.

Not sure if this is just because of the copy-pasting gone wrong but.

  1. ("menu-toggle") seems to be missing the identifier for what type of selector it is (. for class, or # for an id)

  2. ("#wrapper) is missing the closing string quote ("#wrapper").


I don’t really know Angular, but why do you need jQuery?

Thanks for your reply, the jQuery was in the code I got from a framework.

I also don’t understand what you meant in number 1

If menu-toggle is a class the selector should be (".menu-toggle"), if it’s an id it should be ("#menu-toggle").

As it is now it is an element selector, and there is no such HTML element.

You typically don’t interact with the DOM directly this way in Angular. I’m not sure what you mean when you say it was in the code that you “got from a framework”.