Javascript on button

Javascript on button

  

whenever i click button, i want to change its color to red, but its not working . i have set the button to navigate and below is my js code in extended property.

SyntaxEditor Code Snippet

"
document.getElementById("+button1.Id+").style.backgroundColor=Red;
"

Hi Lovish,

Try your javascript code like this.

"
document.getElementById('"+button1.Id+"').style.backgroundColor=Red;
"


Suraj Borade wrote:

Hi Lovish,

Try your javascript code like this.

"
document.getElementById('"+button1.Id+"').style.backgroundColor=Red;
"



its not working. It always happen lsame present in screenshot

Solution

Hi Lovish,

Set the button to Ajax Submit and try this:

"
document.getElementById('"+button1.Id+"').style.backgroundColor='Red';
"

Cheers,

José

Solution

José Costa wrote:

Hi Lovish,

Set the button to Ajax Submit and try this:

"
document.getElementById('"+button1.Id+"').style.backgroundColor='Red';
"

Cheers,

José


Work fine without ajax. By the way thanks Jose