.attr(“disabled”, “disabled”) issue

后端 未结 7 1383
再見小時候
再見小時候 2020-12-28 17:05

I have this function toggles the disabled attribute form a input field:

$(\'.someElement\').click(function(){     
  if (someCondition) {
     console.log($         


        
7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-28 17:31

    I was facing the similar issue while toggling the disabled state of button! After firing the removeProp('disabled') the button refused to get "disabled" again! I found an interesting solution : use prop("disabled",true) to disable the button and prop("disabled",false) to re-enable it! Now I was able to toggle the "disabled" state of my button as many times I needed! Try it out.

提交回复
热议问题