Also note that 'newProp1' and 'newProp2' are not valid HTML
attributes. I'm not sure if you really have them existing on your HTML
page.

If possible, you might want to consider using jQuery's data() to get
and set data associated with an element:
http://docs.jquery.com/Core/data


On Apr 7, 8:21 am, MorningZ <morni...@gmail.com> wrote:
> You're close
>
> $("table").attr({newProp1: "true", newProp2: "7"});
>
> although to be honest, your selector or mine doesn't make all that
> much sense since you would seemingly want to set unique properties on
> each table, something neither line of code does
>
> On Apr 7, 1:48 pm, Scott <william.scott.ba...@gmail.com> wrote:
>
> > I want to add a property (not a class name or id) to all the tables in
> > a web page.  I know I can use $("table") to get all the tables on the
> > page - can I also do this:
>
> >           $("table").each({newProp1:true, newProp2: 7});
>
> > so that now table.newProp1 == true and table.newProp2 == 7 ???
>
>

Reply via email to