Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Grzegorz Ziemba
seal-mask
.a{fill-rule:evenodd;}techdegree
Grzegorz Ziemba
Full Stack JavaScript Techdegree Student 7,959 Points

Problem with drop down menu, project 3 Techdegree

I don't really care if i can share project of techdegree or not, becouse it is frustraiting, when from nowhere you get help, even if you pay and almost BEG for it... Maybe my English is not perfect.. but..

https://github.com/GrzegorzZiemba/ThirdProjects

Maybe someone can tell me how i can repair problem with choosing from Paypal/Bitcoin/Credit Card, coz i tried almost everything, getting through google, MDN, StackOverflow, asked even on Slack (i did not receive valuable help).

The problem is in that : (That's like 1000000 version that i tried)

// checking payment options

$paymentOptionsCard.change(()=>{

// if credit card if($paymentOptions.val()==='Credit Card'){ $creditCard.show(); bullPay = true; } else{ $creditCard.hide(); bullPay = false; } });

$paymentOptionsPaypal.change(()=>{ if($paymentOptionsPaypal.val()==="PayPal"){ $paypal.show(); bullPay = true; } else{ $paypal.hide(); bullPay = false; }});

$paymentOptionsBitcoin.change(()=>{ //if bitcoin if($paymentOptionsBitcoin.val()==="Bitcoin"){ $bitcoin.show(); bullPay = true; } else{ $bitcoin.hide(); bullPay = false; } });

and that's the variables

//getting payment options const $paymentOptions = $("#payment"); //selecting default as Credit card

const $paymentOptionsBitcoin = $paymentOptions.val("Bitcoin"); const $paymentOptionsPaypal = $paymentOptions.val("PayPal"); const $paymentOptionsCard = $paymentOptions.val("Credit Card");

HTML from where i get that variables:

  <select id="payment" name="user-payment">
      <option value="select method">Select Payment Method</option>
      <option value="Credit Card">Credit Card</option>
      <option value="PayPal">PayPal</option>
      <option value="Bitcoin">Bitcoin</option>
    </select>

1 Answer

Steven Parker
Steven Parker
229,708 Points

Can you describe what the issue is? I tried the code and the select responds as I would expect.