jquery remove/add css
<input type="submit" class="btn btn-primary" id="submit" value="提交" disabled /> <input type="button" class="btn btn-primary editable" id="edit_cancel" value="编辑"/>
$(function () { $("#edit_cancel").on("click", function () { var isEditable = $(this).hasClass("editable"); var isCancelable = $(this).hasClass("cancelable"); if (isEditable) { $(this).addClass("cancelable").removeClass("editable").val("取消"); $(".editField").removeAttr("readonly"); $("#submit").removeAttr("disabled"); } if (isCancelable) { $(this).addClass("editable").removeClass("cancelable").val("编辑"); $(".editField").attr("readonly", "true"); $("#submit").attr("disabled", "true"); } }) });
posted on 2014-04-08 18:00 paul_cheung 阅读(358) 评论(0) 编辑 收藏 举报