🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.javascript
Article #51627

Re: newbie: problem z keyup() z jQuery

#51627
From: zpksoft
Date: Thu, 03 Dec 2015 13:05
24 lines
3509 bytes
W dniu środa, 2 grudnia 2015 15:41:44 UTC+1 użytkownik jivan...@poczta.onet.pl napisał:
> Mam jeszcze problemik z jQuery. Potrzebuję na stronce włączać/wyłączać wiersze formularza, w zależności od wyboru na liście <select>. Nie działa mi funkcja setBRTags() która włącza/wyłącza tagi <br clear="both"> (żeby nie tworzyła się pusta przestrzeń na formularzu). Oto ta funkcja:
> 
> function setBRTags() {
>     setCurrentStyle($('div[class="tip" style|="display: block"] + br[clear="both"]')[0], 'display', "");
>     setCurrentStyle($('div[class="tip" style|="display: none"] + br[clear="both"]')[0], 'display', "none");
> }
> 
> Problem w tym, że oba wywołania $(...)[0] zwracają undefined, nie wiem co jest źle (jestem kiepski w jQuery). Wiersz formularza zawiera zawsze <div class="tip">...</div><br clear="both">. Chcę wyłączyć wszystkie br dla odpowiednich wierszy.
> Wszystko jest na http://jsfiddle.net/rto26uvz/3/ ale nie umiem włączyć jQuery na jsfiddle. Jak by ktoś mi mógł pomóc...

Nie pomogę Ci ale sory, nie mogę się powstrzymać. 
Uczepiłeś się tej biblioteki jak ...

Dlaczego po prostu nie napiszesz: 

document.getElementById('xx').style.display='none';

Generalnie w programowaniu wszelkie biblioteki są po to, żeby duże standardowe kody hermetyzować w postaci zwięzłych funkcji. 
Jeżeli kod standardowy jest bardziej zwięzły niż ten z biblioteki to coś jest nie tak z myśleniem :)

Paweł

Paweł
Technical Details
Message-ID: <faa3fede-1c96-491d-8292-09f953c4c238@googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!newsfeed.pionier.net.pl!news.glorb.com!mv3no8749587igc.0!news-out.google.com!z49ni44780qgd.1!nntp.google.com!f78no6116257qge.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
References: <d8bb1c55-aa00-4bbb-bb65-862e4f875852@googlegroups.com> <83661$5652e8f8$6def49cc$2822@nntpswitch.blueworldhosting.com> <896e78d8-8f87-4b30-a111-3bc8b4281839@googlegroups.com> <dcb43$565348af$6def49cc$3178@nntpswitch.blueworldhosting.com> <557dc167-faeb-4079-9b4b-a0596a5776d2@googlegroups.com> <9f68c463-1274-4cef-8767-0209cee70d05@googlegroups.com> <76894416-3fa0-44a3-9964-cbe04f759e0a@googlegroups.com> <9d400653-3feb-4292-b02e-889ae4de43d0@googlegroups.com> <03bfb47b-1223-458b-8ccc-b2a7de94a643@googlegroups.com> <w7p7wcxnca3n.15f9jpairlt9l.dlg@40tude.net> <e8d122de-f26f-49ec-8126-ebea7fd5fd02@googlegroups.com> <yrusih068t0b.y6yjvtvl8wj0.dlg@40tude.net> <n3cj0k$81a$1@speranza.aioe.org> <1w4bibnuwtj22$.1c32m3jeca1jc$.dlg@40tude.net> <d46dc5f2-56c9-4956-8922-d1add9a1a50a@googlegroups.com>

Show Full Headers
Complete Article Headers
X-Received: by 10.182.120.170 with SMTP id ld10mr5903449obb.30.1449147909631;        Thu, 03 Dec 2015 05:05:09 -0800 (PST)
X-Received: by 10.140.31.166 with SMTP id f35mr178604qgf.10.1449147909571; Thu, 03 Dec 2015 05:05:09 -0800 (PST)
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!newsfeed.pionier.net.pl!news.glorb.com!mv3no8749587igc.0!news-out.google.com!z49ni44780qgd.1!nntp.google.com!f78no6116257qge.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: pl.comp.lang.javascript
Date: Thu, 3 Dec 2015 05:05:09 -0800 (PST)
In-Reply-To: <d46dc5f2-56c9-4956-8922-d1add9a1a50a@googlegroups.com>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=83.27.87.85; posting-account=8ND_mgoAAAD5J9y9fnaTB1Kcu7xKWk7Q
NNTP-Posting-Host: 83.27.87.85
References: <d8bb1c55-aa00-4bbb-bb65-862e4f875852@googlegroups.com> <83661$5652e8f8$6def49cc$2822@nntpswitch.blueworldhosting.com> <896e78d8-8f87-4b30-a111-3bc8b4281839@googlegroups.com> <dcb43$565348af$6def49cc$3178@nntpswitch.blueworldhosting.com> <557dc167-faeb-4079-9b4b-a0596a5776d2@googlegroups.com> <9f68c463-1274-4cef-8767-0209cee70d05@googlegroups.com> <76894416-3fa0-44a3-9964-cbe04f759e0a@googlegroups.com> <9d400653-3feb-4292-b02e-889ae4de43d0@googlegroups.com> <03bfb47b-1223-458b-8ccc-b2a7de94a643@googlegroups.com> <w7p7wcxnca3n.15f9jpairlt9l.dlg@40tude.net> <e8d122de-f26f-49ec-8126-ebea7fd5fd02@googlegroups.com> <yrusih068t0b.y6yjvtvl8wj0.dlg@40tude.net> <n3cj0k$81a$1@speranza.aioe.org> <1w4bibnuwtj22$.1c32m3jeca1jc$.dlg@40tude.net> <d46dc5f2-56c9-4956-8922-d1add9a1a50a@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <faa3fede-1c96-491d-8292-09f953c4c238@googlegroups.com>
Subject: Re: newbie: problem z keyup() z jQuery
From: zpksoft <zpksoft@op.pl>
Injection-Date: Thu, 03 Dec 2015 13:05:09 +0000
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit