Having trouble with this code snippet:
function red(opt) {
var sqr;
sqr="r"+parseInt(opt);
hilight_css = {"background-color":"#f00"};
$(#sqr).css(hilight_css);
}
I am calling the function like so:
red(questions);
The variable questions
is set to 1
.
The div's id is r1
.
Despite everything seeming correct, the code isn't working as expected. Can anyone assist in troubleshooting?
If I use alert(sqr)
to check sqr
, it correctly shows r1
, yet the div's color doesn't change.