Dynamic Created Button additinal effect

Dynamic Created Button additinal effect

Good afternoon. I am fairly new to all this and am needing someone to point me in  right direction with an issue I am having.

I have the page working to create a button dynamically inside a div. When the page is first loaded all of the buttons when clicked have their color change and the rest of them return to their default color.


  1. $('.gradeButtons button').on("click",function() {
  2.   $(this).siblings().removeClass('quoteGrading');
  3.   $(this).toggleClass('quoteGrading');
  4. });
For some reason that I cant figure out this does not work for dynamically created buttons.

Can anyone tell me what I am missing or direct me to an example that shows how to dynamically create a button and have it be able to change its color on click?


Gradebuttons is the div identifier.