Question

I've been trying to use jQuery to pull a variable from my form (as a string) and then convert it into a number to have it added to other variables. Instead, NaN is displayed.

<input type="text" name="donation" id="donation" value="0">

var donation = parseInt(form.find('input[text=donation]'), 10);

Used jQuery in the past, but still new to some aspects. Any help is appreciated.

Was it helpful?

Solution

Perhaps because #donaton should be #donation?

OTHER TIPS

var donation = parseInt($('#donation').val(), 10);

http://jsfiddle.net/U96F3/1/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top