Sunday, 15 April 2012

coffeescript - jquery get value of a group of text box -



coffeescript - jquery get value of a group of text box -

i have grouping of textboxes has same css class:

input.push-at.input-small(type='text') input.push-at.input-small(type='text') input.push-at.input-small(type='text') input.push-at.input-small(type='text') input.push-at.input-small(type='text')

now need iterate through these textboxes , read values, tried next didn't work:

hours = [] h in $(@el).find('.push-at') alert(h.val()) <-- complaint 'undefined not function' hours.push h.val()

when debug in browser showed h input element , has value, why complaint? thanks

h needs jquery object. try:

hours = [] h in $(@el).find('.push-at') alert($(h).val()) <-- complaint 'undefined not function' hours.push $(h).val()

ie. $(h).val() can pull jquery function val() of of h.

coffeescript

No comments:

Post a Comment