troubleshooting Question

How can I get this toggle to work?

Avatar of Bruce Gust
Bruce GustFlag for United States of America asked on
2 Comments1 Solution15 ViewsLast Modified:
Here's my HTML:

               <select name="vendor" style="width:600px;" id="vendor">
                  <option name="third_party">Third Party</option>
                  <option name="cart">Cart</option>
            <tr style="display:none;" id="url_row">
               <td style="width:550px;">
               <input type="text" style="width:590px;" name="third_party_url" placeholder="Third Party URL">

Open in new window

Here's my JQuery:


$(document).ready(function() {
   $("#vendor").change(function(e) {
      var value = $("#vendor option:selected").val();
      if(value=="Cart") {
         $("#url_row").css("visibility", "visible");
      else {
         $("#url_row").css("visibility", "hidden");


Open in new window

What I want to do is create the JQuery that will reveal the "url_row" when the user chooses, "Third Party." And if they don't, "url_row" is either hidden on the select change or it merely remains hidden.

I used "toggle" initially, but the "url_row" simply alternated between being visible or hidden irrespective of what the value is.


User chooses, "third_party" then "url_row" is displayed. Otherwise, it's hidden.

How do I pull that off?
David H.H.Lee
Digital Marketing (Hospitality)
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros