我已经被困了一段时间,我找不到解决这个问题的方法。
我想启用一个<select>
onClick 按钮,但它不起作用:
<div class="col-lg-12">
<div class="form-group" style="overflow-y: scroll; height: auto; max-height: 545px;">
<asp:Repeater ID="RepeaterCorrection" runat="server">
<ItemTemplate>
<label>
<asp:Literal ID="litCorLibelle" runat="server" Text='<%# Eval("DESCRIPTION")%>'></asp:Literal>
</label>
<asp:DropDownList ID="ddlCorChamp" runat="server" CssClass="form-control selectpicker"
data-live-search="true"></asp:DropDownList>
<asp:RequiredFieldValidator ID="rfvDropDownList" ForeColor="Red" Display="Dynamic" runat="server"
ErrorMessage="Don't forget that field" ControlToValidate="ddlCorChamp"
InitialValue="Select something" />
<p class="help-block"></p>
<asp:HiddenField ID="hiddenCorIdChamp" runat="server" Value='<%# Eval("IDCHAMP") %>' />
<asp:HiddenField ID="hiddenCorNameChamp" runat="server" Value='<%# Eval("NAMECHAMP")%>' />
<asp:HiddenField ID="hiddenCorType" runat="server" Value='<%# Eval("TYPE")%>' />
</ItemTemplate>
</asp:Repeater>
</div>
<asp:Button ID="btnValid" runat="server" Text="Let's Enable this !"
class="btn btn-primary btn-block" CausesValidation="False" UseSubmitBehavior="False" Enabled="True" />
</div>
//IT WORKS, IT IS DISABLED
$('Select[Champ=ID_REJECT]').prop('disabled', true);
//IT DOESN'T WORK, IT IS STILL DISABLED, EVEN WHEN I CLICK
$('#<%= btnValid.ClientID %>').click(function () {
$('Select[Champ=ID_REJECT]').prop('disabled', false);
//$('Select[Champ=ID_REJET]').removeAttr("disabled");
//$('Select[Champ=ID_REJECT]').attr('disabled', false);
return false;
});
我真的不明白为什么......你知道吗?