Ruby on Rails Tuesday, January 12, 2016

tamouse m. wrote in post #1180583:
> David Williams <lists@ruby-forum.com> writes:
>
>> max_length = counter.data('maximum-length');
>> review_text.keyup(function() {
>> counter.text(max_length - ($(this).val().length));
>> });
>> });
>>
>
> This is a Javascript question, and has nothing to do with Rails.
>
> Nevertheless, I think you need to convert max_length to an integer. If
> it is comming off whatever tag has id="counter" and
> data-maximum-lenght="400", that is being pulled in as a String. Perhaps
> try:
>
> max_length = parseInt(counter.data('maximum-lenght'));
>


It's giving me Nan when I wrap the parseInt method around the counter.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5dfdae2c8d2d1af4e0e6679f5c038472%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment