I'm not sure if I'll describe this very well... but:
I have a div, and I'd like to use the id of the div as a variable in my jQuery function.
There's a variable with the same name as the ID value, and it has already been declared as a number .. at the moment I get NaN.
I just need the variable whatIsIt to land in the function as aqstn - the jsfiddle has an alert with the id.. but it doesn't translate into the number of what it is in the code.. if you know what I mean.!?
To better explain, here's a js fiddle of the problem! http://jsfiddle.net/CpFqk/
jQuery:
$('.add').click(function() {
whatIsIt = $(this).attr('id');
alert (whatIsIt);
base = (base+whatIsIt);
// base = (base+aqstn); --> This works OK
// Some maths to get +- 15%
fifteen = (base*.15)
price1 = (base+fifteen)
price2 = (base-fifteen)
$(".price span.more").html(price1);
$(".price span.less").html(price2);
});