How to change datatable hover background color dynamically?

Hi,

In all samples with datatable hover set is from < style > class .

    < style >
            .grd_hover{
    	    background: #F0DCB6;
            }
    < /style >

I did settings for user, where user can pick color what want for hover . But can’t to set user’s color for class. I tried that :

          ... create grids, with grd_hover class, it's working with #F0DCB6 ... 

           if ( pObj.vart_nust[ 'hover_enbl' ] == '1' )
           {
              const clt = document.getElementsByClassName( "grd_hover" )
              for ( let i = 0; i < clt.length; i++ )
              {
                 clt[ i ].style.backgroundColor = pObj.vart_nust[ 'hover_colr' ]
              }
           }

Sorry, but that isn’t working ?
How to do hover color set dynamically ?

Thanks in advance … Have a nice day ! :slight_smile:

It seems that solved this problem -
Did something like that :

  .grd_hover{
    	background: <?php echo $_SESSION[ 'vartotojas' ][ 'hover_colr' ]; ?>
   }

Now it’s working … :slight_smile: