質問

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.

役に立ちましたか?

解決

Perhaps because #donaton should be #donation?

他のヒント

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

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top