I have created a paypal button with official tool before:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" id="paypal_form">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" id="order_button_id" value="123123abc">
<input type="hidden" name="quantity" id="order_quantity">
<input type="hidden" name="on0" value="Name">
<input type="hidden" name="os0" value="" id="post_name">
<input type="hidden" name="on1" value="Email">
<input type="hidden" name="os1" value="" id="post_email">
<input type="hidden" name="on2" value="Phone">
<input type="hidden" name="os2" value="" id="post_tel">
<input type="image" src="https://www.paypalobjects.com/en_GB/HK/i/btn/btn_buynowCC_LG_wCUP.gif" border="0" name="submit" style="position:relative; top:20px; left:20px;">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
Recently, I need to convert this button to QR code, as I would like to allow my customer to scan the QR code at my shop, and make payment on their mobile phone.
To simplify, there is only one product and the quantity will always be one , How to convert that?
Thanks a lot.
Make a new file like this:
<HTML><head><script>function SF(){document.getElementById('paypal_form').submit();}</script></head><body onload="SF();"><form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" id="paypal_form"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" id="order_button_id" value="123123abc"> <input type="hidden" name="quantity" id="order_quantity"> <input type="hidden" name="on0" value="Name"> <input type="hidden" name="os0" value="" id="post_name"> <input type="hidden" name="on1" value="Email"> <input type="hidden" name="os1" value="" id="post_email"> <input type="hidden" name="on2" value="Phone"> <input type="hidden" name="os2" value="" id="post_tel"> <input type="submit" value="Please click here if you are not redirected." border="0" style="position:relative; top:20px; left:20px;"> <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1"> </form></body></HTML>
And make a QR code point to that.
Related
I have tried several times and relied on the code snippets examples provided by paypal (https://www.paypal.com/mq/smarthelp/article/how-do-i-create-a-discount-code-or-coupon-code-for-my-paypal-buttons-ts1512).
Yet my button doesn't show any % discount as it should.
This is the HTML code snippet, trying to implement a 10% discount (I have just hidden my merchant ID):
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" onsubmit="this.target = 'paypal';
discnt = 10;
coupval = '(blanket)';
ReadForm (this);
discnt = 0;">
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="add" value="1" />
<input type="hidden" name="business" value="XXX" />
<input type="hidden" name="item_name" value="Test Item" />
<input type="hidden" name="amount" value="10.00" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="lc" value="US" />
<input type="hidden" name="baseamt" value="10.00" />
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online!" name="submit" alt="add to cart" />
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
Does any of you know what am I missing/how to fix it?
Thank you so much, take the chance to wish you a good day!
Michele
I'm trying to integrate a payment method called SiamPay on my website but I don't know javascript :(
On SiamPay website they have this instructions:
Copy the following program code to your payment page and
dynamic generate the Amount show below by yourself
<form name="payForm" method="post" action="https://www.siampay.com/b2c2/eng/payment/payForm.jsp">
<input type="submit" name="submit" value="Buy">
<input type="hidden" name="amount" value="Amount">
<input type="hidden" name="merchantId" value="76117579">
<input type="hidden" name="orderRef" value="76117579">
<input type="hidden" name="currCode" value="764" >
<input type="hidden" name="successUrl" value="">
<input type="hidden" name="failUrl" value="">
<input type="hidden" name="cancelUrl" value="">
<input type="hidden" name="remark" value="">
<input type="hidden" name="lang" value="E">
<input type="hidden" name="payMethod" value="ALL">
</form>
Example in jsp:
<%
double amount = qty * unitPrice ;
%>
<form name="payForm" method="post" action="https://www.siampay.com/eng/payment/payForm.jsp">
<input type="submit" name="submit" value="Buy">
<input type="hidden" name="amount" value="<%= amount %>">
<input type="hidden" name="merchantId" value="76117579">
<input type="hidden" name="orderRef" value="76117579">
<input type="hidden" name="currCode" value="764" >
<input type="hidden" name="successUrl" value="">
<input type="hidden" name="failUrl" value="">
<input type="hidden" name="cancelUrl" value="">
<input type="hidden" name="remark" value="">
<input type="hidden" name="lang" value="E">
</form>
I would like to create a field where the user can input an amount to pay in THB (Thai currency) and transport that value to this field:
< input type="hidden" name="amount" value="<%= amount %>">.
I think this is relatively easy but because I never user javascript I'm a little confused.
I appreciate any help.
Thank you so much.
Best Regards,
Alex
There's no need to create an extra input field. You have to change the name=amount input's type to number so that it will become visible to the user. Now the user can enter a number of their choice and click the pay button to submit the payment form.
<form name="payForm" method="post" action="https://www.siampay.com/eng/payment/payForm.jsp">
<input type="submit" name="submit" value="Buy">
<input type="number" name="amount" value="" placeholder="Enter amount in THB ">
<input type="hidden" name="merchantId" value="76117579">
<input type="hidden" name="orderRef" value="76117579">
<input type="hidden" name="currCode" value="764" >
<input type="hidden" name="successUrl" value="">
<input type="hidden" name="failUrl" value="">
<input type="hidden" name="cancelUrl" value="">
<input type="hidden" name="remark" value="">
<input type="hidden" name="lang" value="E">
</form>
To set value to an element, you can use the document.getElementById().value function. Set the amount data into the Amount variable as shown below.
var Amount = 123;
Also, modify the input tag for the amount to include the same id:
<input type="hidden" name="amount" id="amtId" value="Amount">
var Amount = 123;
function setAmountValue() {
document.getElementById('amtId').value = Amount;
}
<form name="payForm" method="post" action="https://www.siampay.com/b2c2/eng/payment/payForm.jsp">
<input type="submit" name="submit" value="Buy" onclick="setAmountValue();">
<input type="hidden" name="amount" id="amtId" value="Amount">
<input type="hidden" name="merchantId" value="76117579">
<input type="hidden" name="orderRef" value="76117579">
<input type="hidden" name="currCode" value="764">
<input type="hidden" name="successUrl" value="">
<input type="hidden" name="failUrl" value="">
<input type="hidden" name="cancelUrl" value="">
<input type="hidden" name="remark" value="">
<input type="hidden" name="lang" value="E">
<input type="hidden" name="payMethod" value="ALL">
</form>
try something like this:
<form name="payForm" method="post" action="https://www.siampay.com/eng/payment
/payForm.jsp">
<input type="submit" name="submit" value="Buy">
<input type="hidden" id="amount" value="<%= amount %>">
<input type="hidden" name="merchantId" value="76117579">
<input type="hidden" name="orderRef" value="76117579">
<input type="hidden" name="currCode" value="764" >
<input type="hidden" name="successUrl" value="">
<input type="hidden" name="failUrl" value="">
<input type="hidden" name="cancelUrl" value="">
<input type="hidden" name="remark" value="">
<input type="hidden" name="lang" value="E">
</form>
<button id='cmdSend'>Click me</button>
<input id='howmuch' type="number" name="amount" value=1000>
And the JS:
document.getElementById("cmdSend").addEventListener("click", myFunction);
function myFunction() {
document.getElementById("cmdSend").innerHTML = "YOU CLICKED ME!";
//Get the value the user typed:
var Value = document.getElementById("howmuch").value;
console.log(Value);
//Set the value into the hidden input, can be done in 2 ways:
document.getElementById("amount").value = Value;
document.getElementById("amount").setAttribute('value',Value);
//Check the value got assigned:
console.log(document.getElementById("amount").value);
}
Fiddle here: https://jsfiddle.net/s2ztkn8L/
I'm trying to update 2 hidden fields of a form based on the checkbox toggle. For some reason, only the first field is getting update and second one doesn't.
Any ideas what am I missing?
echo '
<form id="form1" action="';
echo $paypalURL;
echo '" method="post"> <p></p>';
?>
<input type="hidden" name="business" value="<?php echo $paypalID; ?>">
<input type='hidden' id="item_number" name="item_number" value="1">
Other Amount: <input id="amount" name="amount" value=""> <p></p>
<input type='hidden' id="currency_code" name="currency_code" value="">
<input type="hidden" id="src" value="" name="src" />
<input type="hidden" name="cmd" value="_donations">
Recurring donation?:
<input type="checkbox" id="checkbox" name="checkbox" value="" />
<script type="text/javascript">
var checkbox = document.getElementById('checkbox');
checkbox.addEventListener('change', function()
{
if (this.checked) {
document.getElementById('src').value = '1'
document.getElementById('cmd').value = '_xclick-subscriptions'
}
else
{
document.getElementById('src').value = ''
document.getElementById('cmd').value = '_donations'
}
}, false)
</script>
<!-- Specify URLs -->
<input type='hidden' name='cancel_return' value='http://localhost/wordpress1/wordpress/cancel.php'>
<input type='hidden' name='return' value='http://localhost/wordpress1/wordpress/success.php'>
<!-- Display the payment button. -->
<p><input type="image" name="submit" border="0"
src="images/PayPal-Donate-Button-PNG-Clipart.png" width="80" hight="50" alt="Donate Now"> </p>
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form>
It works, you just didn't add id="cmd" to hidden <input>
Your version:
<input type="hidden" name="cmd" value="_donations">
Correct varsion:
<input type="hidden" id="cmd" name="cmd" value="_donations">
Regards, KJ
I have a PayPal buy now button form on my website that users fill out to purchase a product.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="BHQLX7V2W2GJQ">
<table>
<tr><td><input type="hidden" name="on0" value="Select package">Select package</td></tr><tr><td><select name="os0">
<option value="Premium">Premium $5.49 USD</option>
<option value="Platinum">Platinum $14.49 USD</option>
<option value="Diamond">Diamond $9.49 USD</option>
</select> </td></tr>
<tr><td><input type="hidden" name="on1" value="Enter your 40 character UDiD">Enter your 40 character UDiD</td></tr><tr><td><input type="text" name="os1" id="field" maxlength="40" placeholder="Paste UDiD here"></td></tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypalobjects.com/en_AU/i/btn/btn_buynow_LG.gif" border="0" name="submit" id="paypalButton" alt="PayPal — The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_AU/i/scr/pixel.gif" width="1" height="1">
</form>
In this form, there is a text input field:
<input type="text" name="os1" id="field" maxlength="40">
I want to force the user to enter their exactly 40 character UDiD (for their iOS device) before they can purchase the product by clicking the
'Buy now' button (submit button for the form). How can I do this by disabling/hiding the button if the input field does not have a 40 character string entered?
Edit: new form code
I went ahead a fixed up all your code.
Change your form to this...
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="paypalForm" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="BHQLX7V2W2GJQ">
<table>
<tr><td><input type="hidden" name="on0" value="Select package">Select package</td></tr><tr><td><select name="os0">
<option value="Premium">Premium $5.49 USD</option>
<option value="Platinum">Platinum $14.49 USD</option>
<option value="Diamond">Diamond $9.49 USD</option>
</select> </td></tr>
<tr><td><input type="hidden" name="on1" value="Enter your 40 character UDiD">Enter your 40 character UDiD</td></tr><tr><td><input type="text" name="os1" id="field" maxlength="40" placeholder="Paste UDiD here"></td></tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<input type="image" style="display:none;" src="https://www.paypalobjects.com/en_AU/i/btn/btn_buynow_LG.gif" name="submit" id="paypalButton" alt="PayPal — The safer, easier way to pay online.">
<img alt="" src="https://www.paypalobjects.com/en_AU/i/scr/pixel.gif" width="1" height="1">
</form>
And add this right above you </body> tag
<script>
$(window).keydown(function(event){
if(event.keyCode == 13) {
event.preventDefault();
if($('#field').val().length == 40){
$( "#paypalForm" ).submit();
}
}
});
$(document).ready(function() {
$("#field").keyup(function() {
if ($('#field').val().length == 40) {
$('#paypalButton').fadeIn();
} else {
$('#paypalButton').fadeOut();
}
});
});
</script>
JS
$('p select[name=Membership_Selection]').change(function(e){
if ($('p select[name=Membership_Selection]').val() == 'Z'){
$('#Z').show();
}else{
$('#Z').hide();
}
});
$('p select[name=Membership_Selection]').change(function(e){
if ($('p select[name=Membership_Selection]').val() == 'A_A''){
$('#A_A').show();
}else{
$('#A_A'').hide();
}
});
$('p select[name=Membership_Selection]').change(function(e){
if ($('p select[name=Membership_Selection]').val() == 'B_B'){
$('#B_B').show();
}else{
$('#B_B').hide();
}
});
$('p select[name=Membership_Selection]').change(function(e){
if ($('p select[name=Membership_Selection]').val() == 'C_C'){
$('#C_C').show();
}else{
$('#C_C').hide();
}
});
$('p select[name=Membership_Selection]').change(function(e){
if ($('p select[name=Membership_Selection]').val() == 'D_D'){
$('#D_D').show();
}else{
$('#D_D').hide();
}
});
$('p select[name=Membership_Selection]').change(function(e){
if ($('p select[name=Membership_Selection]').val() == 'E_E'){
$('#E_E').show();
}else{
$('#E_E').hide();
}
});
$('p select[name=Membership_Selection]').change(function(e){
if ($('p select[name=Membership_Selection]').val() == 'F_F'){
$('#F_F').show();
}else{
$('#F_F').hide();
}
});
$('p select[name=Membership_Selection]').change(function(e){
if ($('p select[name=Membership_Selection]').val() == 'G_G'){
$('#G_G').show();
}else{
$('#G_G').hide();
}
});
$('p select[name=Membership_Selection]').change(function(e){
if ($('p select[name=Membership_Selection]').val() == 'H_H'){
$('#H_H').show();
}else{
$('#H_H').hide();
}
});
CSS
/*------------------------------------*\
Members Dropdown
\*------------------------------------*/
#A_A{display:none;}
#B_B{display:none;}
#C_C{display:none;}
#D_D{display:none;}
#E_E{display:none;}
#F_F{display:none;}
#G_G{display:none;}
#H_H{display:none;}
HTML
<div id="membership" align="right">
<p> <font size="2"><center><b>Become a Member</b></p></font></center>
<table>
<tbody><tr><td>
<p> <center> <font size="2">Alphabet Soup Membership Type</font></center></td></tr><tr><td>
<p><center>
<select name ="Membership_Selection" required>
<option value="Z">-- Select an Option --</option>
<option value="A_A">a a $5 year</option>
<option value="B_B">b b $10 year</option>
<option value="C_C">c c : $15 year</option>
<option value="D_D">d d $20 year</option>
<option value="E_E">e e $25 year</option>
<option value="F_F">f f : $30 year</option>
<option value="G_G">g g : $35 year</option>
<option value="H_H">h h : $40 year</option>
</select></center></p>
<center>
<form id="Z" target="paypal" action="" method="post">
<input class="memsubbut" value="Subscribe" type="submit" border="0" name="submit" alt="PayPal"></center>
</form>
<center>
<form id="A_A" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="me#mysite.com">
<input type="hidden" name="item_name" value="Alpha Member - AA">
<input type="hidden" name="item_number" value="AA">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="a3" value="5">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="Y">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="hidden" name="return" value="https://example.com/thanks.php">
<input type="hidden" name="notify_url" value="http://example.com/pay_paypal/paypal.php">
<input class="memsubbut" value="Subscribe" type="submit" border="0" name="submit" alt="PayPal">
</form></center>
<center>
<form id="B_B" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="me#mysite.com">
<input type="hidden" name="item_name" value="Alpha Member - BB">
<input type="hidden" name="item_number" value="BB">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="a3" value="10">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="Y">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="hidden" name="return" value="https://example.com/thanks.php">
<input type="hidden" name="notify_url" value="https://example.com/pay_paypal/paypal.php">
<input class="memsubbut" value="Subscribe" type="submit" border="0" name="submit" alt="PayPal">
</form></center>
<center>
<form id="C_C" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="me#mysite.com">
<input type="hidden" name="item_name" value="Alpha Member - CC">
<input type="hidden" name="item_number" value="CC">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="a3" value="15">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="Y">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="hidden" name="return" value="https://example.com/thanks.php>
<input type="hidden" name="notify_url" value="https://example.com/pay_paypal/paypal.php">
<input class="memsubbut" value="Subscribe" type="submit" border="0" name="submit" alt="PayPal">
</form></center>
<center>
<form id="D_D" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="me#mysite.com">
<input type="hidden" name="item_name" value="Alpha Member - DD">
<input type="hidden" name="item_number" value="DD">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="a3" value="20">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="Y">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="hidden" name="return" value="https://example.com/thanks.php">
<input type="hidden" name="notify_url" value="https://example.com/pay_paypal/paypal.php">
<input class="memsubbut" value="Subscribe" type="submit" border="0" name="submit" alt="PayPal">
</form></center>
<center>
<form id="E_E" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="me#mysite.com">
<input type="hidden" name="item_name" value="Alpha Member - EE">
<input type="hidden" name="item_number" value="EE">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="a3" value="25">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="Y">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="hidden" name="return" value="https://example.com/thanks.php">
<input type="hidden" name="notify_url" value="https://example.com/pay_paypal/paypal.php">
<input class="memsubbut" value="Subscribe" type="submit" border="0" name="submit" alt="PayPal">
</form></center>
<center>
<form id="F_F" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="me#mysite.com">
<input type="hidden" name="item_name" value="Alpha Member - FF">
<input type="hidden" name="item_number" value="FF">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="a3" value="30">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="Y">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="hidden" name="return" value="https://example.com/thanks.php">
<input type="hidden" name="notify_url" value="https://example.com/pay_paypal/paypal.php">
<input class="memsubbut" value="Subscribe" type="submit" border="0" name="submit" alt="PayPal">
</form></center>
<center>
<form id="G_G" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="me#mysite.com">
<input type="hidden" name="item_name" value="Alpha Member - GG">
<input type="hidden" name="item_number" value="GG">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="a3" value="35">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="Y">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="hidden" name="return" value="https://example.com/thanks.php">
<input type="hidden" name="notify_url" value="https://example.com/pay_paypal/paypal.php">
<input class="memsubbut" value="Subscribe" type="submit" border="0" name="submit" alt="PayPal">
</form></center>
<center>
<form id="H_H" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="me#mysite.com">
<input type="hidden" name="item_name" value="Alpha Member - HH">
<input type="hidden" name="item_number" value="HH">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="a3" value="40">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="Y">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="hidden" name="return" value="https://example.com/thanks.php">
<input type="hidden" name="notify_url" value="https://example.com/pay_paypal/paypal.php">
<input class="memsubbut" value="Subscribe" type="submit" border="0" name="submit" alt="PayPal">
</form></center>
</td></tr>
</tbody>
</table>
</div><!-- #membership -->
What am I missing? I thought is was working in sandbox, but I guess didn't look closely.
Essentially, I hid all forms (buttons) in CSS. I then us JS to show them, but only one at a time.
Then HTML for the dropdown select. Is the problem in the JS, selecting the form?
Thanks in advance!
This FIDDLE BEGINS to help you with your problem.
$(document).ready(function () {
$('select[name=Membership_Selection]').change(function (e) {
switch ($(this).val()) {
case "A":
hideAllExcept($("#A"));
break;
case "B":
hideAllExcept($("#B"));
break;
case "C":
hideAllExcept($("#C"));
break;
default:
// do something defaultly
}
});
});
function hideAllExcept(toShow) {
toShow.show();
$("#membership").find('div').each(function () {
if ($(this).attr('id') != toShow.attr('id')) {
$(this).hide();
}
});
}
I had to remove A LOT of code so I could understand. Now you just need to paste some stuff in there and get to work.
Some hints:
1) Don't use center tag, like, ever;
2) Careful with some typos, like double single quotes when you only meant one. Also, 'a'
is different from 'a ', so be extra careful;
3) First, try to build the whole HTML BEFORE using styles (like the font tag, ew),
and style everything using CSS;
4) Don't use table as mean of styling;
5) Refator your code before continuing doing anything else, please.
This is NOT the entire answer you need, but it was what I was able to do.