How do I set the index of a dropdown in jQuery if the way I\'m finding the control is as follows:
$(\"*[id$=\'\" + originalId + \"\']\")
I
$("[id$='" + originalId + "']").val("0 index value");
will set it to 0
Select 4th option
$('#select').val($('#select option').eq(3).val());
example on jsfiddle
I'm writing this answer in 2015, and for some reason (probably older versions of jQuery) none of the other answers have worked for me. I mean, they change the selected index, but it doesn't actually reflect on the actual dropdown.
Here is another way to change the index, and actually have it reflect in the dropdown:
$('#mydropdown').val('first').change();
You want to grab the value of the first option in the select element.
$("*[id$='" + originalId + "']").val($("*[id$='" + originalId + "'] option:first").attr('value'));