where it stands now, tables have no id's however if i put the variable
I'm taking from a td and write it as "country_name" + this.id +i it
produces the variable name (not value) with index and tables get
id's country_name1, country_name2, etc if i remove brackets from country name I get undefined1, undefined2 etc for the ID's the this.id is working fine, problem is getting my text out of the td to work , the index is working fine mkmanning wrote: 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 |
- [jQuery] create table ID's from index Charlie Tomlinson
- [jQuery] Re: create table ID's from index mkmanning
- [jQuery] Re: create table ID's from index Charlie Tomlinson
- [jQuery] Re: create table ID's from index mkmanning
- [jQuery] Re: create table ID's from ind... Charlie Tomlinson
- [jQuery] Re: create table ID's fro... mkmanning