2010-11-01 39 views
0

請幫我找出爲什麼第二次事件未啓動(full code爲什麼第二個事件沒有啓動?

<input type="submit" value="disabled:false" /> 

$(function(){ 
    $('input:submit').bind({ 
     mouseover : function(){ 
      $('input:submit').each(function(){ 
       $(this).attr('disabled', 'disabled'); 
       $(this).val('disabled:' + $(this).attr('disabled')); 
      }); 
     }, 
     mouseout : function(){ 
      $(this).removeAttr('disabled'); 
      $(this).val('disabled:' + $(this).attr('disabled')); 
     } 
    }); 
}); 
+0

你在說什麼第二個事件? – 2010-11-01 13:36:35

+0

喜歡它...問一個問題得到一個問題 – 2010-11-01 13:37:33

+2

可能重複的[禁用輸入Jquery事件](http://stackoverflow.com/questions/3100319/jquery-event-on-a-disabled-input),也是http://stackoverflow.com/questions/2819404/how-can-my-input-element-receive-onclick-events-when-it-is-set-to-disabled – 2010-11-01 13:38:08

回答

2

因爲您正在禁用您的mouseover處理程序中的控件,所以輸入消息被抑制,並且mouseout從不觸發。

+0

但如何啓用? – Algorithm 2010-11-01 13:38:18

+0

我真的不明白你想通過禁用所有提交按鈕,當鼠標指針位於其中之一時實現什麼...... – 2010-11-01 13:41:35

+0

我想了解爲什麼輸入消息被抑制並且mouseout從不會觸發 – Algorithm 2010-11-01 13:45:28

1

mouseout事件的不會觸發disabled元素。

相關問題