我需要當(dāng)我單擊“Editar”按鈕時它允許編輯文本區(qū)域。我嘗試了下面的代碼,但沒有任何反應(yīng)。我嘗試了 prop、removeAttr、removeProp。全部都一樣。沒有什么變化。@using (Html.BeginForm("SalvarJustificativa", "Riscos")){ @Html.AntiForgeryToken() <input type="text" name="co_tratamento_risco" id="co_tratamento_risco" value="@item.co_tratamento_risco" hidden /> <div class="modal-body"> <div class="md-form"> <label for="tx_justificativa " class="mb-4 triangulo">Digite sua justificativa:</label> @Html.TextArea("tx_justificativa", @item.tx_justificativa, new { @class = "md-textarea form-control", @id = "tx_justificativa", @maxlength = "500", @style = "min-width: 100%", @rows = "5", @readonly = "true" }) </div> </div> <div class="modal-footer"> <button id="btnEditarJust" type="button" class="btn btn-danger mt-4">Editar</button> <button id="btnSalvarJust" type="submit" class="btn btn-success mt-4" >Salvar</button> </div>}$(document).ready(function () { $("#btnEditarJust").click(function () { $("tx_justificativa").removeAttr("readonly"); });});
啟用 TextArea 以使用 JQuery 進(jìn)行編輯
湖上湖
2023-08-18 17:21:08