If I read you right, you're trying to assign an ID to the table and it
doesn't already have one? If that's the case, you reference the
table's id in:

 this.id = country_name +this.id + i;

so unless the table already has an id, the second this.id will be
undefined.

On Mar 1, 10:04 pm, Charlie Tomlinson <charlie...@gmail.com> wrote:
> have about 150 html tables ( all same format, headings etc). Trying to assign 
> ID's based on fact they all carry appropriate name in same td index in table.
> not heavily versed in JS and closest I've come is
> $("table").each(function(i){
>                var country_name= $("this tr:eq(1) td:eq(1) ").html();         
>                 this.id = country_name +this.id + i;
>         });
> I can get the country_name to write to an alert however am having trouble 
> getting it to work with index. Tried a variety of things ( swap html() fo 
> rval(), tried $.merge etc
> my outputs to the ID's are working but I either get "undefined with index# or 
> put various bracket on the var and it come out as text instead of it's value
> I don't have the server side experience to do this through php/sql etc and am 
> really close now with it
> any help greatly appreciated

Reply via email to