0
return '<select name="AMStatus" onchange="changeValueuserid(this)" id="optbox-'+index2+'" class=\"opcodes\"><option value="3">Authorize</option><option value="14">Reject</option></select>';

I want to get option value to the variable.I using jQuery.above code also in my js file.

1 Answers1

0

$('.test').each(function()
    {

          {      

        var $val = $("option:selected",this).text();
      alert($val);
     }

    });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select class="test">      
      <option>
        Number 1
      </option>
      <option>
        Number 2
      </option>
      <option>
        Number 4
      </option>      
   </select>

This is a quick example.

deqoda
  • 28
  • 1
  • 4