We have a asp.net mvc application where we have to disable mvc html controls within a css class which works fine in IE browser but it does not work in Chrome and Firefox.
This is the code we use at the moment:
$(".q-answer").attr("disabled", "disabled");
We have tried to disable with prop and also different options but it didn't work.
Please see below code from developer tools:
IE browser :
<p **disabled="disabled"** class="q-answer">
<select name="QuestionnaireResponses.IsAvailableForReview" id="ddlIsAvailableForReview" onchange="IsAvailableForReview()">
<option value="">Select</option>
<option selected="selected" value="Y">Yes</option>
<option value="N">No</option>
</select>
</p>
Chrome Browser :
<p class="q-answer">
<%: Html.DropDownListFor(m => m.QuestionnaireResponses.IsAvailableForReview, new SelectList(yesNoOptions, "Value", "Text"), "Select", new { @id = "ddlIsAvailableForReview", onChange = "IsAvailableForReview()" })%>
</p>
If you see both elements from browsers, IE works fine as it adds disabled property but for Chrome it doesn't add.
Any help is appreciated.
<%: Html.DropDownListFor(m => m.QuestionnaireResponses.IsAvailableForReview, new SelectList(yesNoOptions, "Value", "Text"), "Select", new { @id = "ddlIsAvailableForReview", onChange = "IsAvailableForReview()" })%>
IE : – Vamshi Chilukuri Oct 13 '15 at 08:13` element. Its the `
– Oct 13 '15 at 08:44element but how this is working for IE .
– Vamshi Chilukuri Oct 13 '15 at 09:39<%:questionnaireLbls["IsLoanPaidOff"]%>
<%: Html.DropDownListFor(m => m.QuestionnaireResponses.IsLoanPaidOff, new SelectList(yesNoOptions, "Value", "Text"), "Select", new { @id = "ddlIsLoanPaidOff", onChange = "IsLoanPaidOff()" })%>
tag, but still issue exists in Chrome and Firefox.
– Vamshi Chilukuri Oct 13 '15 at 09:40` element - in this case `$('q-answer select').prop('disabled', true);`
– Oct 13 '15 at 09:45