javascript - Read all dropdown box values in JQuery -


I have a dropdown box in an MVC 4 view. When the value changes in the dropdown box, I want to read all of the selected values. Each selection consists of 3 items. First of all: ID, second: The value that the user sees on the form and on the third: the path of a file is. Everything works fine, but I can not read the template path. How can I use jquery to read the selected user template pad

I know how IDs and selected values ​​can be read, but I want to find a way to read the path.

Creates a SelectList used in my controller view:

  ViewBag.TemplateList = new selection list (DB templates list), "Template ID", " Template "," templatepath ");   

Uses the scene selection list and populates the dropdown box:

  @ html.DropDownListFor (model = & gt; model.TemplateId, IEnumerable as ViewBag.TemplateList & lt; SelectListItem & gt ;, "- no template -", new {@id = "TemplateChoice"})   

using jquery with me There is a javascript file, when the template dropdown box changes, I want to read the template path from the dropdown box.

My JavaScript file is as follows:

  $ ("document"). Change (function () {$ ("# template choise"). Change (function () {var templateID = $ ("# TemplateChoice option: selected"). Val (); var templateText = $ ("# TemplateChoice option: selected "). Text (); / / here I need the code which read TemplatePath});});   

Any help would be appreciated.

See value in a third SelectList constructor

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -