run a function when a user clicks on any list element

Posted by sova on Stack Overflow See other posts from Stack Overflow or by sova
Published on 2010-12-28T21:48:33Z Indexed on 2010/12/28 21:53 UTC
Read the original article Hit count: 197

Filed under:
|

This is probably a very common question, but I was unable to find an answer myself;

All my list elements call the function setQuery like this

onClick="admin_stats.setQuery(this);"

rather than [hardcode] add this to every list element, is there a way to simply have it run when a list element is clicked?

I'm not very familiar with jQuery Live or binding/unbinding, but I think they would play a role here?

Before I reinvent a rather square-looking wheel I thought I might ask =)

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery