0

I'm new to Jquery, and I'm trying to figure out how to use the "this" keyword. When I try to test it using a simple button with a console log, it keeps giving me the entire window object. Could someone please explain to me what I'm doing wrong? I just want "this" to return the button.

`

$("button").on("click", (e) => {
    console.log(this)
    console.log($(this))
})

` This is what I tried. and here is what it gives me in the console log:

What I'm getting in console log

I'm not 100% sure, but I think this is the Window object. At least, I'm sure this isn't my button.

0 Answers0