首页javascriptclickjQuery Event - 如何从跨度触发锚链接点击

jQuery Event - 如何从跨度触发锚链接点击

我们想知道如何从跨度触发锚链接点击。

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.5.2.js'></script>
</head>
<body>
  <a id="clickit" href="" onclick="console.log('onclick')">click</a>
  <br/>
  <br/>
  <br/>
  <span onclick="javascript:$('#clickit').trigger('click')">fire the a click!</span>
  
  
  <br/>
  <br/>See console for the output
</body>
</html>