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

c# - passing input text from view to contoller with FacebookContext using Facebook app -

ios - Does Core Data autoupdate a many to many relationship on saving -

Calling a C++ function from C# by passing a string with variable size to it -