Вопрос

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