Try... var forAttr = '#last_name'; $('a[href=' + forAttr + ']').text('ciao');
On Oct 13, 10:03 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > I have this small issue that I cannot solve. > > I look for an element checking the attribute href: > > $('a[href='#last_name']').text('ciao'); > > And It's fine but if I try to use a variable the selector fail: > > var forAttr = '#last_name'; > $('a[href=forAttr]').text('ciao'); > > forAttr is exactly #last_name > > Some help??? > > Thanks > > Andrea