I'm trying to change the color of a div
if the following condition is true, if( @ViewBag == "reservado" )
, but I can not, could someone tell me what the code would look like with that condition described above?
I'm programming in Asp.NET
As% w_that I want to change the color is this:
<div class="num">001</div>
Last code I tried:
function trocaCor(){
var condi = @ViewBag.status;
if( condi == "reservado"){
document.getElementById("num").style.backgroundColor = green;
}
}
But I do not know if this is correct, I want it to be executed when the page is loaded (if it is correct).
I also tried the following code:
if( @ViewBag == "reservado" ){
$('.num').css('background-color','#000000');
}
But it did not work out