๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: jquery - wartosc checkboxa przekazanego w argumencie fcji

#49501
From: Peter
Date: Fri, 06 Nov 2009 01:28
29 lines
1388 bytes
Kazik pisze:
> html:
> 
> [...]
> <td><input type='checkbox' onclick='aqq(this)' /></td>
> [...]
> 
> js:
> 
> function aqq(e) {
>  var td=$(e).parent();
>  var stan=td.children('input:checked').length; // 1 - zaznaczony, 0 - 
> odznaczony
>  alert(stan);
> }
> 
> 
> Domyslam sie ze mozna to zapisac w prostszy sposob, bez odwolywania sie 
> do td. Chodzi mi oczywiscie o odczyt stanu checkboxa. Macie jakies 
> sugestie?

A nie moลผesz tak?

function aqq(e){
  alert(e.checked); // false - niezaznaczony, true - zaznaczony
}

-- 
Peter
Technical Details
Message-ID: <hcvtjo$7pn$1@node1.news.atman.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!newsfeed.atman.pl!not-for-mail
References: <hcvmed$7l7$1@inews.gazeta.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!newsfeed.atman.pl!not-for-mail
From: Peter <peter.may@poczta.fm>
Newsgroups: pl.comp.lang.javascript
Subject: Re: jquery - wartosc checkboxa przekazanego w argumencie fcji
Date: Fri, 06 Nov 2009 02:28:41 +0100
Organization: ATMAN
Lines: 29
Message-ID: <hcvtjo$7pn$1@node1.news.atman.pl>
References: <hcvmed$7l7$1@inews.gazeta.pl>
NNTP-Posting-Host: inet20907nq-3.nat.umts.dynamic.eranet.pl
Mime-Version: 1.0
X-Trace: node1.news.atman.pl 1257470394 7991 213.158.199.103 (6 Nov 2009 01:19:54 GMT)
X-Complaints-To: usenet@atman.pl
NNTP-Posting-Date: Fri, 6 Nov 2009 01:19:54 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
In-Reply-To: <hcvmed$7l7$1@inews.gazeta.pl>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit