Javascript using onclick event

i’m trying to use onclick event
but i cant get any response when i click the button
does’nt matter if i try using onclick event in html or inside javascript nothing happens

I’m not quite sure what you want to accomplish here. Is it something like this?
I cleaned it up the javascript a little bit. Generally you should be handling all of your logic separately from the html. Also, you needed to set up a function that would handle the click event. With plain javascript, you do this by adding an event listener, and passing a callback function.

1 Like

Also, since you’re not using a constructor, you don’t need “this”. You can just reference the object.

1 Like

thanks for the code
not looking for anything specific
im just learning object oriented js basics