delegate

English [?d?l??ɡet]

n. ??, ?? ???

vt.

jquery ?? ??() ??? ???

??: undelegate() ???? Delegate() ???? ?? ??? ?? ??? ??? ???? ?????.

??: ??$(selector).undelegate(selector,event,function)

????:

??? ??

jquery ?? ??() ??? ?

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("body").delegate("p","click",function(){
    $(this).slideToggle();
  });
  $("button").click(function(){
    $("body").undelegate();
  });
});
</script>
</head>
<body>
<p>這是一個段落。</p>
<p>這是另一個段落。</p>
<p>點(diǎn)擊任何段落可以令其消失。包括本段落。</p>
<button>從所有元素刪除由 delegate() 方法添加的事件處理器</button>
</body>
</html>
???? ?? ?

??? ????? ??? "???? ??" ??? ?????

      <label id="eojan"></label>
      ParametersDescription
      selector ?? ?? . ??? ???? ???? ?? ???? ?????.
      ???????. ???? ???? ?? ?? ??? ??? ??? ?????.
      ????. ??? ?? ??? ??? ??? ?????.
      <li id="eojan"><legend id="eojan"></legend></li>
      <span id="eojan"></span><span id="eojan"><small id="eojan"></small></span>