Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > pl.comp.lang.javascript > #3199
| X-Received | by 10.129.99.70 with SMTP id x67mr25591102ywb.5.1448265435397; Sun, 22 Nov 2015 23:57:15 -0800 (PST) |
|---|---|
| X-Received | by 10.140.82.210 with SMTP id h76mr424788qgd.5.1448265435355; Sun, 22 Nov 2015 23:57:15 -0800 (PST) |
| Path | csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!f78no1478485qge.1!news-out.google.com!f23ni323qge.0!nntp.google.com!f78no1478484qge.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | pl.comp.lang.javascript |
| Date | Sun, 22 Nov 2015 23:57:14 -0800 (PST) |
| In-Reply-To | <708d7a2a-8fe4-4ecc-bf80-f9985d2c04a3@googlegroups.com> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=31.182.89.249; posting-account=xnOwqAoAAAAJ48pUkVrL2a6sJByqdB8s |
| NNTP-Posting-Host | 31.182.89.249 |
| References | <d8bb1c55-aa00-4bbb-bb65-862e4f875852@googlegroups.com> <708d7a2a-8fe4-4ecc-bf80-f9985d2c04a3@googlegroups.com> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <2dac095d-f2ad-412a-b1a4-962fda697788@googlegroups.com> (permalink) |
| Subject | Re: newbie: problem z keyup() z jQuery |
| From | nkab@toya.net.pl |
| Injection-Date | Mon, 23 Nov 2015 07:57:15 +0000 |
| Content-Type | text/plain; charset=ISO-8859-2 |
| Content-Transfer-Encoding | quoted-printable |
| X-Received-Bytes | 3667 |
| X-Received-Body-CRC | 4013440129 |
| Xref | csiph.com pl.comp.lang.javascript:3199 |
Show key headers only | View raw
W dniu niedziela, 22 listopada 2015 14:03:09 UTC+1 użytkownik zpksoft napisał:
> W dniu sobota, 21 listopada 2015 16:42:53 UTC+1 użytkownik jivan...@poczta.onet.pl napisał:
> > Uczę się JavaScriptu. Na razie jestem kiepski. Mam na formularzu (nazwanym formName) pole textarea (nazwane 'Opis:') i chciałbym żeby użytkownik miał informację ile znaków może jeszcze wprowadzić. Robię to tak (używam jQuery na stronie bo jest mi potrzebne do innych rzeczy):
> >
> > $('form#' + formName + ' textarea#message').keyup(function () { return onKeyUpAtTextArea('contact', 'message'); });
> > ...
> > function maxLengthOfArea(textarea, counter) {
> > if (textarea.getAttribute('maxlength') >= textarea.value.length) {
> > counter.innerHTML = textarea.getAttribute('maxlength') - textarea.value.length;
> > return true;
> > }
> > return false;
> > }
> > ...
> > function onKeyUpAtTextArea(controller, elemId) {
> > 'use strict';
> > var formName = getCurrentFormName(controller);
> > var currentForm = getCurrentForm(controller);
> > var textarea = getFormElement(currentForm, elemId);
> > var counter = $('form#' + formName + ' span#' + elemId + '_left')[0];
> > return maxLengthOfArea(textarea, counter);
> > }
> >
> > Problem w tym, że funkcja onKeyUpAtTextArea nie jest wołana przy naciskaniu klawisza w polu textarea. Debuggując JavaScript zauważyłem, że przy wykonywaniu kodu jQuery:
> >
> > // Handle event binding
> > jQuery.fn[ name ] = function( data, fn ) {
> > return arguments.length > 0 ?
> > this.on( name, null, data, fn ) :
> > this.trigger( name );
> > };
> >
> > mam:
> >
> > fn == /\r?\n/g
> > data == "ReferenceError: data is not defined"
> > name == ""
> > jQuery.fn.name == undefined
> >
> > Czy to może być przyczyną tego że onKeyUpAtTextArea nie jest wywoływana?
> > Rozwiązanie mi działało, ale po przerobieniu strony na responsywną przestało działać.
> > Jak rozwiązać problem?
>
> Ala nakomplikowane, aż mi się nie chce czytać :)
> Raczej nie onkeyUp tylko onChange kontrolki. I po co to całe JQuery?
>
> Paweł
No właśnie. Przecież nawet jak pytający korzysta z JQuery
to nic nie stoi na przeszkodzie aby używać czystego JS.
Andrzej.
Back to pl.comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar
newbie: problem z keyup() z jQuery jivanmukta@poczta.onet.pl - 2015-11-21 07:42 -0800
Re: newbie: problem z keyup() z jQuery zpksoft <zpksoft@op.pl> - 2015-11-22 05:03 -0800
Re: newbie: problem z keyup() z jQuery nkab@toya.net.pl - 2015-11-22 23:57 -0800
Re: newbie: problem z keyup() z jQuery Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2015-11-23 11:22 +0100
Re: newbie: problem z keyup() z jQuery jivanmukta@poczta.onet.pl - 2015-11-23 06:18 -0800
Re: newbie: problem z keyup() z jQuery Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2015-11-23 18:11 +0100
Re: newbie: problem z keyup() z jQuery jivanmukta@poczta.onet.pl - 2015-11-23 11:03 -0800
Re: newbie: problem z keyup() z jQuery jivanmukta@poczta.onet.pl - 2015-11-23 12:11 -0800
Re: newbie: problem z keyup() z jQuery jivanmukta@poczta.onet.pl - 2015-11-23 21:44 -0800
Re: newbie: problem z keyup() z jQuery jivanmukta@poczta.onet.pl - 2015-11-24 02:45 -0800
Re: newbie: problem z keyup() z jQuery jivanmukta@poczta.onet.pl - 2015-11-24 07:29 -0800
Re: newbie: problem z keyup() z jQuery Borys Pogoreło <borys@pl.edu.leszno> - 2015-11-26 00:10 +0100
Re: newbie: problem z keyup() z jQuery jivanmukta@poczta.onet.pl - 2015-11-26 00:07 -0800
Re: newbie: problem z keyup() z jQuery jivanmukta@poczta.onet.pl - 2015-11-26 02:41 -0800
Re: newbie: problem z keyup() z jQuery Borys Pogoreło <borys@pl.edu.leszno> - 2015-11-28 00:07 +0100
Re: newbie: problem z keyup() z jQuery Jivanmukta <jivanmukta@poczta.onet.pl> - 2015-11-28 16:59 +0100
Re: newbie: problem z keyup() z jQuery Borys Pogoreło <borys@pl.edu.leszno> - 2015-11-29 17:30 +0100
Re: newbie: problem z keyup() z jQuery jivanmukta@poczta.onet.pl - 2015-12-02 06:41 -0800
Re: newbie: problem z keyup() z jQuery zpksoft <zpksoft@op.pl> - 2015-12-03 05:05 -0800
Re: newbie: problem z keyup() z jQuery jivanmukta@poczta.onet.pl - 2015-12-03 09:12 -0800
Re: newbie: problem z keyup() z jQuery Borys Pogoreło <borys@pl.edu.leszno> - 2015-12-06 22:45 +0100
Re: newbie: problem z keyup() z jQuery Jivanmukta <jivanmukta@poczta.onet.pl> - 2015-12-12 13:10 +0100
Re: newbie: problem z keyup() z jQuery Kviat <kviat@NIE_DLA_SPAMUneostrada.pl> - 2015-11-25 17:10 +0100
Re: newbie: problem z keyup() z jQuery Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2015-11-25 21:10 +0100
csiph-web