user6468132
user6468132

Reputation: 403

Select item from selection box

I want to select my country from the selection box; http://tr.investing.com/currencies/single-currency-crosses

there is a change_result(); in it's on change.

I get the selection box as;

$("#symbols")

But how will I trigger the on change box and reload the page according to the new selected option.

Upvotes: 0

Views: 54

Answers (2)

user5827241
user5827241

Reputation:

Something like this maybe?

    $("#myselect").change(function() {
    
         var selectedOption = $("#myselect option:selected").text();
         var selectedValue = $(this).val();
         
         // Do something here

         $("#"+selectedValue).fadeIn(1000);
    
    });
<div id="2" style="display:none;">
Magic Text
</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select id="myselect">
  <option value="1">Option 1</option>
  <option value="2">Option 2</option>
  <option value="3">Option 3</option>
</select>

Upvotes: 1

ubm
ubm

Reputation: 636

I think this will helps you

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select id="symbols">
  <option value="0">Select</option>
  <option value="1">A</option>
  <option value="2">B</option>
  <option value="3">C</option>
</select>
<script>
$(function(){
    $('#symbols').on('change',function(){
        var value=$(this).val();
        alert(value);
        });
});
</script>

Upvotes: 0

Related Questions