javascript - Change colour of elements previously clicked -


I have a list of elements, which I want to change color after clicking on the user's button (then a different Clicked). I know how to change the color of the button on click, I will use the onclick , but how will I change the color of the button after I click?

For example, the user clicks the Titanic nothing happen. Then the user changes color to Titanic 7, Titanic and saves that color. After that user clicks the Titanic 9 Both the Titanic and Titanic 7 have given the "visit" color.

See JSFiddle

If I understand you correctly, I do:

  $ ('. Song'). Click (function (e) {e.preventDefault (); $ ('Selectnext'). CSS ('background-color', 'blue'). RemoveClass ('select'); $ (this) .addClass (' Selectnext ');});    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -