Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #8067

Re: uncheck radio group

Newsgroups comp.lang.javascript
Subject Re: uncheck radio group
From "Evertjan." <exjxw.hannivoort@interxnl.net>
References <3c81f60b-9264-4083-ba1f-1c87d4636197@q35g2000prh.googlegroups.com>
Message-ID <Xns9F955D957A862eejj99@194.109.133.133> (permalink)
Date 2011-11-06 08:11 +0000

Show all headers | View raw


cerr wrote on 05 nov 2011 in comp.lang.javascript:

> I have a bunch of radio groups on a page 

Where else?

> and would like to uncheck them all together on button click.

This is a wrong idea IMHO.

A radio-group without any checked is strictly illegal and error-prone.

Better make a hidden radio-button that can be checked by javascript.
And no loop is needed.


<form>
<input type='radio' name='a' value='none' 
checked style='display:none;' id='aNone'>
<label><input type='radio' name='a' value='1'> 1</label><br>
<label><input type='radio' name='a' value='2'> 2</label><br>
<label><input type='radio' name='a' value='3'> 3</label><br>
</form>

<button onclick = "document.getElementById('aNone').checked = true;">
Uncheck
</button>

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

uncheck radio group cerr <ron.eggler@gmail.com> - 2011-11-05 15:57 -0700
  Re: uncheck radio group Elegie <elegie@anonymous.invalid> - 2011-11-06 01:02 +0100
    Re: uncheck radio group Swifty <steve.j.swift@gmail.com> - 2011-11-06 07:59 +0000
  Re: uncheck radio group Denis McMahon <denismfmcmahon@gmail.com> - 2011-11-06 00:10 +0000
  Re: uncheck radio group "Evertjan." <exjxw.hannivoort@interxnl.net> - 2011-11-06 08:11 +0000
    Re: uncheck radio group "Evertjan." <exjxw.hannivoort@interxnl.net> - 2011-11-06 08:16 +0000
      Re: uncheck radio group "Evertjan." <exjxw.hannivoort@interxnl.net> - 2011-11-06 09:10 +0000
  Re: uncheck radio group Dr J R Stockton <reply1144@merlyn.demon.co.uk> - 2011-11-06 19:58 +0000

csiph-web