Skip to content
Advertisement

Select only the clicked button JQuery

I have this ajax function, which should change the style of the clicked button, but for some reason it does not work. I’m not getting any errors in the console and the ajax call is successful Any idea what’s wrong here?

JavaScript

Html:

JavaScript

Advertisement

Answer

Your issue is with using this incorrectly. The way you are using it, it is going to reference the object you pass into the ajax command

JavaScript

— Edit —

In javascript, you listen for a click like so:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement