I haven't tested this but it might work for you:

$j('<input type="text" name="symptom" value="Enter Symptom"
class="focusClear"/>').insertAfter(this).focus(function(){
                $(this).val('');
        });

That should have the right context (your new node, not this) and you
don't have to look it up again in another line.

HTH!

On May 1, 5:07 pm, jquertil <[EMAIL PROTECTED]> wrote:
> Hello...
>
> I'm creating an input element like this:
>
>         $(this).after('<input type="text" name="symptom"
>                           value="Enter Symptom" class="focusClear"/
>
> >');
>
> then I want to clear the value on focus like so:
>
>         $('.focusClear').focus(function(){
>                 $(this).val('');
>         });
>
> Obviously this doesnt work cine jquery doesnt know about the element
> yet. Do I need to write it as an extension?
>
> Thanks!

Reply via email to