Yes, you can do this!!!

Sorry for my poor english but I hope help you!

$("input[name='txtName']").css('background-color','#F00');

And this way too.

var field_property = "txtName";

*$("input[name='+field_property+']").css('background-color','#F00');*



2009/11/3 barbercraig <craigbarbe...@googlemail.com>

>
> Hi Guys,
>
> This is my very first post! so please be kind.... :)
>
> Ok, i am very novice to jQuery. But what i am trying to do is use the
> jQuery
> attribute selector to select an input with a specific name.
>
> I can select an input of name type fine by doing the folowing:
>
>      $("input[name='name']").do something...
>
> But, can i pass a variable into that filter? to search for a variable?
>
> So if i had a variable called 'field_name' containing the text: 'email',
> can
> i do something like this:
>
>     $("input[name='(field_name)']").do something...
>
> So that it in this caseit would find an input with the name 'email'
>
> Sorry if this is a doofus question, just can't find any examples of this
> anywhere
>
> thanks for your help guys,
>
> cheers
>
> Craig
>
> --
> View this message in context:
> http://old.nabble.com/passing-a-variable-through-an-attribute-filter-tp26160102s27240p26160102.html
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.
>
>


-- 
Abraços......

Marcel Araujo
System Analyst
Developer Java/PHP/RIA
Linux User #490101

Reply via email to