Solved

Javascript or Jquery

Posted on 2011-03-22
6
268 Views
Last Modified: 2012-05-11
Have 3 radio buttons with prices  and display then in a div as sub total. Every product has different shipping options. Would like that price to be also added to hidden text box input


Looking for something like this http://www.wnews9.com/evin-sandbox/melatrol.com/order-page/order-page.php
0
Comment
Question by:ninjadude12
[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
  • 3
6 Comments
 

Author Comment

by:ninjadude12
ID: 35195827
thanks
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 35195860
check this simple one
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<script src="jquery-1.4.2.min.js"></script>
	<script>
		$(document).ready(function(){
			$("input[name='radioPrice']").bind("click", function(){
				$("#subtotal").html("Subtotal is " + $(this).val());
			});
		});

	</script>
</HEAD>

<BODY BGCOLOR="#FFFFFF">
	Option1 <input type="radio" id="radio1" value="$149.95" name="radioPrice"/>149.95 <br/>
	Option2 <input type="radio" id="radio2" value="$49.95" name="radioPrice"/>49.95<br/>
	Option3 <input type="radio" id="radio3" value="$99.95" name="radioPrice"/>99.95<br/>

	<span id="subtotal"></span>

</BODY>
</HTML>

Open in new window

0
 

Author Comment

by:ninjadude12
ID: 35195969
this does not do anything...

would like 3 options in radio and for each option chosen separate shipping options.
0
Industry Leaders: 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!

 
LVL 40

Expert Comment

by:gurvinder372
ID: 35196045
try this then
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<script src="jquery-1.4.2.min.js"></script>
	<script>
		$(document).ready(function(){
			$("input[name='radioPrice']").bind("click", function(){
				$("#options").show();
				$("#subtotal").html("Subtotal is " + $(this).val());

				switch( $(this).index() )
				{
					case 0:
						$("#options").html("<option value='31.88'>Rush Delivery 31.88</option><option value='12.88'>Standard Delivery 12.88</option>");
					break;

					case 1:
						$("#options").html("<option value='51.88'>Rush Delivery 51.88</option><option value='32.88'>Standard Delivery 32.88</option>");
					break;

					case 2:
						$("#options").html("<option value='71.88'>Rush Delivery 71.88</option><option value='52.88'>Standard Delivery 52.88</option>");
					break;
				}
			});
		});

	</script>
</HEAD>

<BODY>
	Option1 <input type="radio" id="radio1" value="$149.95" name="radioPrice"/>149.95 <br/>
	Option2 <input type="radio" id="radio2" value="$49.95" name="radioPrice"/>49.95<br/>
	Option3 <input type="radio" id="radio3" value="$99.95" name="radioPrice"/>99.95<br/><br/>

	<span id="subtotal"></span><br/><br/>

	Choose a Shipping option: <select id="options"><option value=""><----Select an option above----></option></select>
</BODY>
</HTML>

Open in new window

0
 

Author Comment

by:ninjadude12
ID: 35198856
gurvinder372 this is very close I have it here http://www.evinw.com/jquery-order-page/index.html

but when you hit option 3 the shipping does not work. Also on that page the total is not coming out on the input box as well. Need one like its there and one in a input to put in form.
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 35249222
sorry for the delayed reply,

Replace the line 6-26 by

$(document).ready(function(){
                  $("input[name='radioPrice']").bind("click", function(){
                        $("#options").show();
                        $("#subtotal").html("Subtotal is " + $(this).val());

                                var value = $('input:radio[name='radioPrice']:checked').val();


                        switch( value  )
                        {
                              case "$149.95":
                                    $("#options").html("<option value='31.88'>Rush Delivery 31.88</option><option value='12.88'>Standard Delivery 12.88</option>");
                              break;

                              case "$49.95":
                                    $("#options").html("<option value='51.88'>Rush Delivery 51.88</option><option value='32.88'>Standard Delivery 32.88</option>");
                              break;

                              case "$99.95":
                                    $("#options").html("<option value='71.88'>Rush Delivery 71.88</option><option value='52.88'>Standard Delivery 52.88</option>");
                              break;
                        }
                  });
            });
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When using a search centre, I'm going to show you how to configure Sharepoint's search to only return results from the current site collection. Very useful when using Office 365 with multiple site collections.
Configuring Remote Assistance for use with SCCM
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Suggested Courses

734 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