Can a link have both an onclick jquery and javascript event?

Posted by odpogn on Stack Overflow See other posts from Stack Overflow or by odpogn
Published on 2011-01-09T00:36:04Z Indexed on 2011/01/09 0:53 UTC
Read the original article Hit count: 110

Filed under:
|
|
|
|

I have a link that jQuery listens to, and if clicked it will toggle another div. The link also has an onclick javascript action. When I click the link, the div I want to toggle shows, but the javascript doesn't execute.

  1. Is it possible to get the javascript to execute AND have jQuery toggle the div?
  2. If so what would I put in the jQuery code to allow the link to execute the onclick javascript action?

jQuery script

$(function() {
  $('#links a').live('click', function() {
  $("#showall").toggle('slow');
  });
});

my link

<div id ="links">
  <a href="some javascript" onclick="javascript">Play</a>
</div>

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery