Home >Web Front-end >JS Tutorial >Detailed explanation of live binding of multiple events in jQuery

Detailed explanation of live binding of multiple events in jQuery

黄舟
黄舟Original
2017-06-26 09:18:581518browse

Before 1.4.0 (excluding 1.4.0), multiple bindings cannot be used. A single example is:

 $('.clickme').live('click', function() {
  // Live handler called.
  });

1.4.0-1.4.2 has started to support it. The examples are as follows:

bjbzj.codeplex.com;
  shbjz.codeplex.com;
  tjbjz.codeplex.com;
  cqbjz.codeplex.com;
  hebbjz.codeplex.com;
  jlbjz.codeplex.com;
  sybjz.codeplex.com;
  dlbjz.codeplex.com;
  asbjz.codeplex.com;
  jnbjz.codeplex.com;
  qdbjz.codeplex.com;
  zbbjz.codeplex.com;
  dybjz.codeplex.com;
  ytbjz.codeplex.com;
  wfbjz.codeplex.com;
  tybjz.codeplex.com;
  xamjz.codeplex.com;
  sjzmt.codeplex.com;
  tsmt.codeplex.com;
  qhdmt.codeplex.com;
  lybjz.codeplex.com;
  zzmt.codeplex.com;
  whmt.codeplex.com;
  csbjz.codeplex.com;
  wxbjz.codeplex.com;
  njbjz.codeplex.com;
  szbjz.codeplex.com;
  nbbjz.codeplex.com;
  hzbjz.codeplex.com;
  fzbjz.codeplex.com;
  xmbjz.codeplex.com;
  kmbjz.codeplex.com;
  cdbjz.codeplex.com;
  hfbjz.codeplex.com;
  gybjz.codeplex.com;
  xzbjz.codeplex.com;
  ntbjz.codeplex.com;
  jsbjz.codeplex.com;
  zjbjz.codeplex.com;
  yzbjz.codeplex.com;
  ncbjz.codeplex.com;
  gzbjz.codeplex.com;
  szjzb.codeplex.com;
  zsbjz.codeplex.com;
  stbjz.codeplex.com;
  fsbjz.codeplex.com;
  lzbjz.codeplex.com;
  zhbjz.codeplex.com;
  hzmt.codeplex.com;
  ycbjz.codeplex.com;
  xnbjz.codeplex.com;
  whjz.codeplex.com;
  czmt.codeplex.com;
  bjbjz.codeplex.com;
  shmt.codeplex.com;
  tjjz.codeplex.com;
  cqjz.codeplex.com;
  hebjz.codeplex.com;
  jljz.codeplex.com;
  syjz.codeplex.com;
  dljz.codeplex.com;
  asjz.codeplex.com;
  jnjz.codeplex.com;
  qdjz.codeplex.com;
  zbjz.codeplex.com;
  dyjz.codeplex.com;
  ytjz.codeplex.com;
  wfjz.codeplex.com;
  tyjz.codeplex.com;
  xajz.codeplex.com;
  sjbjz.codeplex.com;
  tsjz.codeplex.com;
  qhbjz.codeplex.com;
  lyjz.codeplex.com;
  zzjz.codeplex.com;
  whbz.codeplex.com;
  csjz.codeplex.com;
  wxjz.codeplex.com;
  njjz.codeplex.com;
  szjz.codeplex.com;
  nbjz.codeplex.com;
  hzjz.codeplex.com;
  fzjz.codeplex.com;
  xmjz.codeplex.com;
  kmjz.codeplex.com;
  cdjz.codeplex.com;
  hfjz.codeplex.com;
  gyjz.codeplex.com;
  xzjz.codeplex.com;
  ntjz.codeplex.com;
  jhjz.codeplex.com;
  zjjz.codeplex.com;
  yzjz.codeplex.com;
  ncjz.codeplex.com;
  gzjz.codeplex.com;
  szgjz.codeplex.com;
  zsjz.codeplex.com;
  stjz.codeplex.com;
  fsjz.codeplex.com;
  lzjz.codeplex.com;
  zhjz.codeplex.com;
  fzmjz.codeplex.com;
  ycjz.codeplex.com;
  xnjz.codeplex.com;
  whmjz.codeplex.com;
  czjz.codeplex.com;
  $('.hoverme').live('mouseover mouseout', function(event) {
  if (event.type == 'mouseover') {
  // do something on mouseover
  } else {
  // do something on mouseout
  }
  });

Versions after 1.4.3 begin to support another update method:

$('a').live({
  click: function() {
  // do something on click
  },
  mouseover: function() {
  // do something on mouseover
  }
  });
  //鼠标移入移出事件
  $(document).ready(function(){
  $('.title span').live({
  mouseenter:function(){
  alert('enter');
  },
  mouseleave:function(){
  alert('leave');
  }
  });
  });

The above is the detailed content of Detailed explanation of live binding of multiple events in jQuery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn