I think the fool-proof way would be to do something like adding a
class, for example:

$("input.text:not(.focused)").focus(function(){ ... }).addClass("focused");

That way you can run that line as many times as you want and it'll
never re-bind the focus event.

--John

On 5/31/07, John R <[EMAIL PROTECTED]> wrote:

I have a table with rows of input fields that is dynamic in that the
user can add / remove rows.  I'm trying to trigger a function whenever
the user clicks in any of the fields, so for example I use this:

$("input.text").focus( function() { alert("In textfield"); } );

After a row is dynamically added, I need to reapply this so the new
rows fields will trigger the function as well, but if I just use that
line again then the original rows get triggered twice.

So, I'm trying to figure out how to filter out all the fields that
already have a focus event attached.  Basically, how do I say "Give me
all input.text's that don't have an onfocus set?

Thanks
John


Reply via email to