javascript - How to get the @htmlDropDownList selected value? -
i have @htmldropdownlist
@html.dropdownlist("mylist", new selectlist(model.list, "id", "movie"))
in mvc3 view.
how can capture selected value of drop down list using javascript , use change contents of view according selected item?
to value simple:
$('#mylist').val()
for second part of question need more info.
update
how use value?
//get url movie description , define id 0, easier replace lateron. var moviedescriptionurl = '@url.action("details", "movies", new { id = 0})'; //get movieid var movieid = $('#mylist').val(); //update div $('#movie-description').load(moviedescriptionurl.replace('0', movieid));
assuming have "details" action return partial view.
Comments
Post a Comment