I'm trying to set a value to input element(s) that match the ID.
But the jQuery.each is picking up only the first/one input element.
I'm trying to perform a ajax post and i need both these ID to have the same value.
HTML
@Html.HiddenFor(u => u.TransID)
//<input id="TransID" name="TransID" type="hidden" value="0">
@Html.DropDownListFor(u => u.TransID, Model.TransModes)
//<input id="TransID" name="TransID" value="0">
Script
$("#TransID").each(function () {
$(this).val("2")
alert($(this).val());
});
Cheers