-1

I have multiple buttons which are Order 1 and a contact form below it with a field with multiple options (Order 1, Order2, etc...)

When I click on the "Order 1" button , I want the field to select Order 1. And if I click on the "Order 2" button, I want the field to select Order 2 for example. Is there a way to do that with javascript?

I've seen this done in some websites but can't remember exactly where.

  • Provide relevant code in question. Basically, on buttons click, you just need to set select element specific value – A. Wolff Jan 27 '15 at 12:13
  • 1
    Forget the code. As you are using jquery, just try something like this http://stackoverflow.com/questions/496052/jquery-setting-the-selected-value-of-a-select-control-via-its-text-description sorry for this, but really search before asking. – jPO Jan 27 '15 at 12:14

1 Answers1

0

Something like this?

http://jsfiddle.net/792Lek15/

$('button').on('click', function(){
    var selected = $(this).data('select');
    $('form select').val(selected);
});
pumpkinzzz
  • 2,907
  • 2
  • 18
  • 32