Home  >  Article  >  Web Front-end  >  How to set the button gray and unavailable in jquery

How to set the button gray and unavailable in jquery

coldplay.xixi
coldplay.xixiOriginal
2020-12-03 09:42:462895browse

How to set the button gray and unavailable in jquery: 1. Set the dynamic binding of parameters in the html code, the code is [onclick="getpass(${audit.lid})"]; 2. jquery code , the code is [$("#" id).css({'background-].

How to set the button gray and unavailable in jquery

The operating environment of this tutorial: windows7 system, jquery3.2.1 version , Dell G3 computer.

jquery setting button gray unavailable method:

html code

My id and Method parameters are all dynamically bound

<button id="${audit.lid}" onclick="getpass(${audit.lid})" style="background-color:#8ac007;color:white">通过</button>

jquery code

function getpass(id){
$("#"+id).css({&#39;background-color&#39; : &#39;gray&#39;});
$("#"+id).attr("disabled", true); 
}

Related learning recommendations: javascript video tutorial

The above is the detailed content of How to set the button gray and unavailable in jquery. For more information, please follow other related articles on the PHP Chinese website!

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