[jQuery] Re: Another question on how to passing parameters to event handler

2009-01-27 Thread mctpursuer
Thanks. But how to you pass the "index" in the following case? function rPrompt(index, msg) { alert(index); if($("#prompt").length == 0){ $("").appendTo("body"); $("#prompt").dialog({ title: "Test", m

[jQuery] Re: Another question on how to passing parameters to event handler

2009-01-27 Thread Eric Garside
Easiest way I know of isn't to pass a parameter, but to use and destroy a data element on the object: $('#somelement').data('event.data', {firstname: 'Tom', lastname: 'Robinson', index: 4}).click(function(){ var data = $(this).data('event.data'); data.firstname; // First name data.ind