Works great. Approach 2: This approach uses jQuery to change the background color after clicking the button. Before Click on button: After Click on button: The html() method: It set or return the content (innerHTML) of the selected elements. After clicking the button: First we create the change_text function. Toggle some bits and get an actual square. See online demo and code. It also adds an image to the < input type= '' button text to the! We will create one small html-css-js project, that will contain only one button and clicking on that button will change the color of a text. : onstyle: string "primary" Style of the on toggle. There's actually a hidden requirement: the input must remain working, i.e. It's a good idea to save the project, because that will allow you to change the project in case you decide to do something different with future galleries. It specifies a link on the web page or a place on the same page where the user navigates after clicking on the link.