返回值:Booleanevent.isImmediatePropagationStopped()
V1.3jQuery event.isImmediatePropagationStopped() 方法概述
根據(jù)事件對(duì)象中是否調(diào)用過(guò) event.stopImmediatePropagation() 方法來(lái)返回一個(gè)布爾值。
示例
描述:
檢測(cè) event.stopImmediatePropagation() 是否被調(diào)用過(guò)。
代碼:
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.min.js"></script> </head> <body> <button>click me</button> <div id="stop-log"></div> <script> function immediatePropStopped(e) { var msg = ""; if ( e.isImmediatePropagationStopped() ) { msg = "called"; } else { msg = "not called"; } $("#stop-log").append( "<div>" + msg + "</div>" ); } $("button").click(function(event) { immediatePropStopped(event); event.stopImmediatePropagation(); immediatePropStopped(event); }); </script> </body> </html>