homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

If Then ?
form syntax

Msg#: 4432725 posted 8:10 pm on Mar 23, 2012 (gmt 0)

I'm not sure if this falls under if, then syntax, but I have a radio button and I'd like a set of text fields to open only if Option A is selected. Does anyone know a script for this? -Much obliged.



5+ Year Member

Msg#: 4432725 posted 2:54 am on Mar 24, 2012 (gmt 0)

This is one way, this is my first time using the
disabled attribute so you may want to investigate further.

<label for="ena">Enable</label><input type="radio" id="ena" name="ed" value="Enable"/>
<label for="dis">Disable</label><input type="radio" id="dis" name="ed" value="Disable"/>
<input type="text" id="some" name="something">some</input>
<input type="text" id="thing" name="something" disabled="disabled">thing</input>

<script type="text/javascript">
function enable(){

function disable(){
window.onload = function(){


Msg#: 4432725 posted 3:17 am on Mar 24, 2012 (gmt 0)

Hmmm. I got the radio button and both text fields with either choice. I tried putting the <script> between <head></head> but got same result.
Thanks though.


5+ Year Member

Msg#: 4432725 posted 10:14 am on Mar 24, 2012 (gmt 0)

wrap the entire reply in the body tags and it will work.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved