declaring a variable blocks my code
is something wrong here? declaring those variables stops the开发者_JAVA技巧 execution of my code :(
var color = $('fieldset input[type=checkbox]').data("color");
if(color === orange){var bgy = '-1'}
else{var bgy = '-37'};
If you need more info please ask me :)
Did you mean color=='orange'
?
If it didn't help please alert the value of color
.
Dude... whats orange
in
if(color === orange){var bgy = '-1'}
Use firebug :D
Define bgy outside the if block and just set the value inside.
Nope, that should work fine...only thing I'd suggest is this:
var bgy;
var color = $('fieldset input[type=checkbox]').data("color");
if(color === 'orange'){ bgy = '-1' } else { bgy = '-37' };
Make sure jQuery's actually finding your element, and alert out the value of color
to troubleshoot. Other than that, I'll need more code to go on...
Probably you need to use
if(color === 'orange')
other wise
orange
will be treated as variable which is undefined.
精彩评论