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

how to set visibility to hidden after the onclick envent handler

 7:56 am on Apr 25, 2011 (gmt 0)

Someome can help me?

I have this javascript function:

<script type="text/javascript" >
function getSelectedRadio(payment_means){
return document.getElementById('chq').style.visibility='visible';
return document.getElementById('chq').style.visibility='hidden';

I use this function to set visibility of a text box to 'visible' when the third radio button (hereunder) is clicked and to set it back to 'hidden' when i click on another radio button. For the first time i click to the third radio button, it displays the hidden text box and when i click on another radio button, i expected the textbox to disappear but it's not the case. What should I do?

Here is the corresponding html:
<input type="radio" name="payment_means" value="Cash" id="pay1" />&nbsp;Cash
<input type="radio" name="payment_means" value="Bank Transfer" id="pay2" />&nbsp;Bank Transfert
<input type="radio" name="payment_means" value="Cheque" id="pay3" onClick="getSelectedRadio()" />&nbsp;Cheque
<input type="text" name="chq" value="" id="chq" style="visibility:hidden;" />


thank you for your kind help



 12:55 pm on Apr 25, 2011 (gmt 0)

put onClick="getSelectedRadio()" on all 3 input type="radio"


 1:56 pm on Apr 25, 2011 (gmt 0)

Dear daveVk,
1000 thousand thanks. It works now!

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