0

I have a drop-down on Cart page from 1 to 5+. When I select from 1 to 4, Qty is updated along with the price.

When I select 5+ from Dropdown, dropdown should hide and input text-box should be displayed.

Also, I do not want to reload Cart page onChange event of drop-down.

0

Html:

<select id="dropdown">
  <option value="text">1</option>
  <option value="text">2</option>
  <option value="text">3</option>
  <option value="text">4</option>
  <option value="text">5</option>
</select>
<input type="text" id="input" placeholder="text input" style="display:none;">

Js:

$( "#dropdown" ).on( "change", function() {
  var val = $('#dropdown option:selected').text();
  $('#input').hide();
  if(val >= '5'){   
    $('input').show();
    $("#dropdown").hide('slow');
  }
});

JSFIDDLE DEMO

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.