Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
221,295 Points

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