function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dileep KumarDileep Kumar 

Javascript and visualforce related problem

Hi All,

<script>
function setVar(){
       var v= document.getElementById("cbid").getAttribute.style.(backgroundColor).value;
       if(v == ''){
           window.alert('ywewdf');
       }else{
           window.alert('welcome');
       }
}
</script>

I am calling this function on button click but i am not getting any alert.

Actually i want to get the background color of  <td>. By using javaScript.

Please help me.

Thanks in advance,

Dileep

Best Answer chosen by Dileep Kumar
Vivek DVivek D
// Try This 
var v = document.getElementById("cbid").style.getPropertyValue("background-color");