Disable/enable an input with jQuery?

后端 未结 18 2716
礼貌的吻别
礼貌的吻别 2020-11-21 07:47
$input.disabled = true;

or

$input.disabled = \"disabled\";

Which is the standard way? And, conversely, how do yo

18条回答
  •  遥遥无期
    2020-11-21 07:54

    If you just want to invert the current state (like a toggle button behaviour):

    $("input").prop('disabled', ! $("input").prop('disabled') );
    

提交回复
热议问题