If parameters can be defined at the moment of click, I would suggest a binding method:
$('a').click(function(){ someFunc(this.val, 2, 3, 4); })
In one case, I might think about doing this inline if you create multiple links in a loop where parameters 1, 2, 3, or 4 change depending on the backend variable or something:
<% for( int i = 0; i < 4; i++) { %> <a onclick="someFunc(1,<%= i %>,3,4"></a> <% } %>
Personally, I always try to bind to an event in the $ (document) .ready () callback.
Hope this helps
Mike gleason jr couturier
source share