Quantcast
Channel: OutSystems Community
Viewing all articles
Browse latest Browse all 1476385

[Forums] How to change button color on its click

$
0
0

Narendra Kothamire wrote:

Hi Pankaj 

Thanks for the reply but how should I do it with Javascript

I have 4 buttons all of the white color and I want to change the color of the clicked button to orange and change the color of a previously selected button to white color

Hi Narendra,

On Click of button Add a Screen Action with Ajax Refresh and add a Run Java Script Action from HTTPRequestHandler.

The Javascript is as below:

SyntaxEditor Code Snippet

"document.getElementById('"+Id-of-button-1+"').style.backgroundColor='#004a80';//Changes BG to Blue
document.getElementById('"+Id-of-button-1+"').style.color='white'; //Changes Text to White
document.getElementById('"+Id-of-button-2+"').style.color='#004a80'; //Changes Text to Blue
document.getElementById('"+Id-of-button-2+"').style.backgroundColor='white';//Changes BG - White
document.getElementById('"+Id-of-button-3+"').style.color='#004a80';
document.getElementById('"+Id-of-button-3+"').style.backgroundColor='white';
document.getElementById('"+Id-of-button-4+"').style.color='#004a80';
document.getElementById('"+Id-of-button-4+"').style.color='white';

You will have to repeat this script on all button clicks with tweaks in color.


Regards,

Rushabh Shah


Viewing all articles
Browse latest Browse all 1476385

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>