Home >Web Front-end >JS Tutorial >How to set the button gray and unavailable in jquery
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-].
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({'background-color' : 'gray'}); $("#"+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!