Reputation: 7351
is something wrong here? declaring those variables stops the 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 :)
Upvotes: -1
Views: 91
Reputation: 35117
Define bgy
outside the if block and just set the value inside.
Upvotes: 0
Reputation: 6446
Did you mean color=='orange'
?
If it didn't help please alert the value of color
.
Upvotes: 2
Reputation: 13583
Dude... whats orange
in
if(color === orange){var bgy = '-1'}
Use firebug :D
Upvotes: 0
Reputation: 28755
Probably you need to use
if(color === 'orange')
other wise
orange
will be treated as variable which is undefined.
Upvotes: 0
Reputation: 23283
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...
Upvotes: 0