[SOLVED]How to Change Background Color on Selected Button
I am working on a HTML page and I have multiple buttons at the top. I have some good animation working when one is selected, however I am trying to also get it to change the background color of the button when it is clicked on as well.
This way the user knows which button they have selected when filling out the form.
Any suggestions?
Thanks, Kristi CarterThis message has been edited. Last edited by: <Emily McAllister>,
WebFocus, App Studio 8.0.09
November 14, 2016, 06:24 PM
Waz
I would suggest adding a js click event and change the colour or the class.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
November 14, 2016, 06:37 PM
Kristi Carter
I tried going down that route but couldn't figure out the actual code to make the color change. Any chance you could provide a sample?
Thanks, Kristi Carter
WebFocus, App Studio 8.0.09
November 14, 2016, 06:47 PM
Waz
Do you have the click event ?
You will need to get the control first.
You could use document.getElementById or jquery or IbComposer_getComponentById
It is just a simple case of changing the colour directly or with the class.
Many examples out there, just google it
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
November 15, 2016, 09:38 AM
Joel Elscott
Here is an example of code that I am using. On my page I have 5 date range buttons - daily, weekly, monthly, quarterly, year-to-date. You'll need to create a "Requests/Actions" JavaScript call for each of your buttons. The first JavaScript function name would be restoreButtonColors, and then another JavaScript function to change the color. In my example below it would be dailyBtn_onclick. You'll also need to create a new function for each of your buttons, and change the color hex values to meet your needs.