[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Clear Javascript Radio Buttons

Posted on 2014-01-15
4
Medium Priority
?
237 Views
Last Modified: 2014-01-15
I have a form with four radio buttons. See http://lawnsprinklerservices.com/lss_form2.php at the bottom. (Services offered).

When the customer clicks one of the four choices, I will display a confirmation message & if they answer "no", I want co clear ALL the selections.

The name of the radio buttons is "plan".

I can't figure out how to do this in Javascript.

Can someone help.

Thanks
0
Comment
Question by:Richard Korts
  • 2
  • 2
4 Comments
 
LVL 83

Expert Comment

by:leakim971
ID: 39782828
replace :
jj = confirm("Please confirm selection of plan " + plan + " at a base price of $" + a);
if (!jj) {
     return false;
}

Open in new window

by :
jj = confirm("Please confirm selection of plan " + plan + " at a base price of $" + a);
if (!jj) {
     $$("[name='plan']").setProperty("checked", false);
     return false;
}

Open in new window

0
 
LVL 17

Accepted Solution

by:
OmniUnlimited earned 2000 total points
ID: 39782898
I don't see any jQuery in your source (did I miss it?)

In case you don't have jQuery, you can always use the following code:

jj = confirm("Please confirm selection of plan " + plan + " at a base price of $" + a);
if (!jj) {
     var ele = document.getElementsByName("plan");
     for(var i=0;i<ele.length;i++)
        ele[i].checked = false;
     return false;
} 

Open in new window

0
 
LVL 83

Expert Comment

by:leakim971
ID: 39782921
line 3 is not jQuery but Mootools
0
 
LVL 17

Expert Comment

by:OmniUnlimited
ID: 39782980
Ah, right.  Wasn't familiar with that.  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…
Suggested Courses

873 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