To disable an input field using jQuery, you can use the prop() method to set the disabled property to true. Here's an example:

HTML:

<input type="text" id="myInput" value="Hello World">
<button id="disableBtn">Disable Input</button>

JavaScript:

$(document).ready(function(){
  $('#disableBtn').click(function(){
    $('#myInput').prop('disabled', true);
  });
});

In the above example, when the "Disable Input" button is clicked, the prop('disabled', true) line will disable the input field with the id "myInput"

jquery input 禁用

原文地址: https://www.cveoy.top/t/topic/hBkd 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录