Trying to get value of a radio button in JavaScript

M

Mufasa

I have a couple of radio buttons that make various things appear/disappear
on the screen through JavaScript. All works great. Problem is I'll click a
radio button, something will appear, I reload the page for other reasons and
the item disappears. The reason it disappears is I have to set the state
initially to invisible so it doesn't show up initially.

The radio buttons are html radio buttons not aspx radio buttons so I can
have the javascript react to it.

I'm also using master pages just to complicate life.

So how do I check the value of the radio button in javascript so I can then
make the item appear depending on which button was selected.

TIA - Jeff.
 
M

Mike Placentra II

Hi Jeff,

You can use Request.Form("checkboxname") in ASP.net to do some logic
to change the initial visibility on postback.

-Michael Placentra II
 
G

Guest

I have a couple of radio buttons that make various things appear/disappear
on the screen through JavaScript. All works great. Problem is I'll click a
radio button, something will appear, I reload the page for other reasons and
the item disappears. The reason it disappears is I have to set the state
initially to invisible so it doesn't show up initially.

The radio buttons are html radio buttons not aspx radio buttons so I can
have the javascript react to it.

I'm also using master pages just to complicate life.

So how do I check the value of the radio button in javascript so I can then
make the item appear depending on which button was selected.

TIA - Jeff.

I think you can use something like this

document.getElementById('ID').checked = true;

where ID is the id of your radio-button
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top