简体   繁体   English

单击提交按钮后禁用选择按钮

[英]Disable a select button after clicking on submit button

I am trying to disable a select field once I click on Search Submit button. 单击搜索提交按钮后,我试图禁用选择字段。 But after clicking the button, it temporarily disables it and it shows enable. 但是单击该按钮后,它将暂时禁用它,并显示启用。 Here is my jquery code : 这是我的jQuery代码:

$(document).ready(function () {
  $("#search").click(function() {
    $("#cha_name").attr("disabled", true);
 });
});

Help would be appreciated. 帮助将不胜感激。

instead of 代替

$("#cha_name").attr("disabled", true);

use 采用

$( "#cha_name" ).prop( "disabled", true );

or 要么

$("#cha_name").attr("disabled", "disabled");

Use 采用

$("#cha_name").prop("disabled", true);

instead of 代替

$("#cha_name").attr("disabled", true);//$("#cha_name").attr("disabled", "disabled"); will work

use this below code it may help you. 使用以下代码可以为您提供帮助。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM