0

In my mvc dropdwon i am not getting selected text for dropdown which is disabled

@Html.DropDownList("ServiceID", ViewBag.Services as SelectList, "Select Service", new { @class ="form-control" ,name="ServiceID",disabled="disabled"})

And my jquery

var selectedText = $("#ServiceID option:selected").text();
Arun Raju
  • 139
  • 2
  • 15
  • no duplication of value – Arun Raju Mar 01 '17 at 13:26
  • Please set element as readonly instead of disabled. Refer :http://stackoverflow.com/questions/2700696/how-do-i-submit-disabled-input-in-asp-net-mvc – J-Mean Mar 01 '17 at 13:28
  • `no duplication of value` - No idea what you mean by that. Please check the linked post as it uses a hidden field to track the selected value. – Nope Mar 01 '17 at 13:30
  • 1
    @J-Mean Please see last note on your linked post in regards to using readonly on a select `A SELECT tag is an exception though.` Meaning a `select` tag will not be readonly as you can still select values even though it has the attribute, even if applying the readonly attribute to the option tags as well.► [http://plnkr.co/edit/9T3wxSfhml7r4FRJeL5a?p=preview](http://plnkr.co/edit/9T3wxSfhml7r4FRJeL5a?p=preview) – Nope Mar 01 '17 at 13:33
  • @Fran Thanks got to know something new. – J-Mean Mar 01 '17 at 13:36
  • Thank u it is working fine – Fran – Arun Raju Mar 01 '17 at 15:15

0 Answers0