Hi - what browser are you testing this in? I gave it a quick test in Firefox 2 and it worked fine.
I applied jQuery to this very page and then ran: var f = 'to'; alert(jQuery("[EMAIL PROTECTED]'" + f + "']").attr('id')); On Apr 19, 11:14 am, Creazion <[EMAIL PROTECTED]> wrote: > Hi, I need help with the following code. > > This one alerts 'undefined': > > var field = 'test'; > alert(jQuery("[EMAIL PROTECTED]'" + field + "']").attr('id')); > > and this one gives me the correct id: > > alert(jQuery("[EMAIL PROTECTED]'test']").attr('id')); > > So why the first one doesn't work? > > Thanks for your help.