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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -