I have multiple inputs. These are multiplied and the result is checked wether it is higher or lower than certain values. This result shall be printed with an alert. It is just the first step, therefore I have an alert for me, so I can assure myself, that the result is correct.
The Input
<span class="input input--haruki">
<input class=".someClass" type="text" id="input-q1a" />
<label class=".someClass" for="input-q1a"><span class=".someClass">Some text</span></label>
</span>
Jquery
var $htA = parseFloat($("#input-q1a").val(), 10);
var $avisA = ($htA *2);
var $euA = 0;
var $gaA = ($htA *3);
function exposeumfang() {
if ($gaA <= 8) {
$euA = 20;
} if ($gaA > 8 && $gaA <= 12) {
$euA = 24;
} if ($gaA > 12 && $gaA <= 16) {
$euA = 28;
} if ($gaA > 16 && $gaA <= 20) {
$euA = 32;
} if ( $gaA >20 && $gaA <= 24) {
$euA = 36;
} if ($gaA > 24 && $gaA <= 28) {
$euA = 40;
} if ($gaA >28) {
$euA = 44;
}
}
someButton.on('click', function(){
alert('Some text ' + exposeumfang() + ' more text ' + $avisA + ' last bit of text.');
});
I only get undefined and NaN for the two variables in the alert. I can't get a hold of this problem... :/ What am I doing wrong?