On Tue, Sep 22, 2009 at 4:41 PM, WalterGR <walte...@gmail.com> wrote:
> > On Sep 22, 4:35 pm, Ricardo <ricardob...@gmail.com> wrote: > > > This doesn't make any sense. If you're already using jQuery why keep > > your handler in the HTML? > > Because I need to pass additional information to the event handler in > a clean way. (i.e. rather than hacks using various attributes on the > anchor.) Is there a non-hackish way to do this? > Hi Walter: Sort of along the lines of what Scott had suggested, but rather than using a plugin, could you use jQuery's built in data() method? http://docs.jquery.com/Core/data#namevalue Assuming you're generating these links dynamically you could assign the 'foobarbaz' value to an element with a particular ID. $(document).ready(function() { $('#myID').data('myFirstArg', 'foobarbaz'); $('#myID').click(function() { alert($(this).data('myFirstArg')); return false; }); }); <a href="#" id="myID">show details</a> That's a fairly simplistic example. The example in the docs shows how you can store complex data using JSON. Would something like that work? Charlie -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.