How to disable/enable input field on click with jQuery

后端 未结 7 804
慢半拍i
慢半拍i 2020-12-31 13:36

How to properly enable/disable input field on click with jQuery?

I was experimenting with:

$(\"#FullName\").removeAttr(\'disabled\');
7条回答
  •  醉话见心
    2020-12-31 14:34

    To toggle a field between disabled and enabled, try this:

    $('#toggle_button').click(function () {
        $('#FullName').prop("disabled",
    
        function (i, val) {
            return !val;
        });
    })
    

提交回复
热议问题