I'm Having trouble access the hidden field PartsId. The output HTML from this gives the field part_PartsId. How would I get the value of it from my typeAhead function? My JavaScript is firing, but only seems to return the typeahead object information that fired it.
<div class="input-group col-lg-3 scrollable-dropdown-menu">
<div class="input-group-addon">@Html.LabelFor(a => part.Part)</div>
@Html.HiddenFor(a => part.PartsId)
@Html.EditorFor(a => part.Part, new { htmlAttributes = new { @class = "form-control typeahead" } })
</div>
My JavaScript File
$(".typeahead").on("typeahead:selected", typeAhead)
.on("typeahead:autocompleted", typeAhead);
function typeAhead(obj, suggestion) {
var test = $(this).parent().find('partidClass').first();
}
UPDATE: It seemed relevant to show the MVC Generated HTML
<div class="input-group">
<div class="input-group-addon"><label>Part</label></div>
<input class="partidClass"type="hidden" value="12345" />
<input class="form-control typeahead text-box single-line" type="text" />
</div>