Home >Web Front-end >JS Tutorial >Implementation code for setting the disabled attribute of a button using jquery_jquery

Implementation code for setting the disabled attribute of a button using jquery_jquery

WBOY
WBOYOriginal
2016-05-16 18:15:081100browse

To set the button to be disabled in the html tag, you can use the following code

In jquery you can use the attr() function to modify the button The disable attribute
$("#test").attr('disabled',false);

jquery controls the disabled attribute of the button

Copy the code The code is as follows:

$('#button').attr('disabled',"true"); Add the disabled attribute
$( '#button').removeAttr("disabled"); Remove disabled attribute
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn