0

If this code checks the value of a radio button, what do I change if I need to check the value of a drop down box?

var checker= jq('input[name="radioname"]:radio:checked').attr("val");
Will
  • 465
  • 1
  • 3
  • 12
  • probably duplicate: http://stackoverflow.com/questions/1643227/get-selected-text-from-drop-down-list-select-box-using-jquery – TygerKrash Oct 21 '15 at 15:28

2 Answers2

1
var selecter = jq('select[name="selectname"]').val();
Victor Levin
  • 1,167
  • 6
  • 11
0

Try that :)

$(':radio[name="sex"][value="male"]').prop("checked", true);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

Sex : <input type="radio" name="sex" value="male">Male 
<input type="radio" name="sex" value="female" checked="checked">Female