Solved

How do I select a default value on a radio button with Javascript?

Posted on 2014-10-27
3
107 Views
Last Modified: 2014-10-27
I need a javascript to mark a radio button as checked on a form that I am creating.

Here is the radio button
<input id="PC69230_rdo_97_4" type="radio" name="PC69230$givingLevels" value="rdo_97_4" onclick="rdo_OnClick(this);">

Open in new window

0
Comment
Question by:dauyeung
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 40406797
From:
http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_radio_checked2
<script>
function check() {
    document.getElementById("PC69230_rdo_97_4").checked = true;
}
</script>

Open in new window

0
 
LVL 22

Expert Comment

by:plusone3055
ID: 40406807
<input id="PC69230_rdo_97_4" type="radio" name="PC69230$givingLevels" value="rdo_97_4"  checked = "checked" onclick="rdo_OnClick(this);"
0
 

Author Closing Comment

by:dauyeung
ID: 40406898
I removed the function call and it worked perfectly.  Thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question