[Solved] Javascript and “div” Tags


Looks like you were close you just need to take a little more time checking your formatting…

There are a lot of unanswered questions here but this is what you were shooting for, I think.

<head>

<style type="text/css">
.ok
{ 
    background-color:green; 
}

.dead
{ 
    background-color:red; 
}
</style>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">

var variable1 = '<?php echo($variable1); ?>';

function emea()
{
    if(variable1 !== '')
    {
        document.getElementById('test').className="dead";
    }
    else
    {   
        document.getElementById('test').className="ok";
    }
}
</script>

</head>

<body onload="emea();">

<div id="test">BlaBla</div>

</body>

solved Javascript and “div” Tags