I have the following function:
function red(opt) {
var sqr;
sqr="r"+parseInt(opt);
hilight_css = {"background-color":"#f00"};
$(#sqr).css(hilight_css);
}
I call this function from another function
red(questions);
the variable questions has the value 1.
The id of my div is r1.
When I use this code it does not work. Can anybody help fix this?
If I use alert(sqr) to show me the value of sqr it says r1
but the color of the div doesn’t change
You have to pass a string to the
$function, like so: