yeah unfortunately that won't work - the input fields need to be different widths to fit into the table cells... ah well, might just have to add them manually - bugger :-S
Allan ----- Original Message Follows ----- > > Hey Allan, > > That's strange because it should compute the width and > return it. > > I'd just make it a fixed width, like 60 pixels or so. > > Pat > > On Aug 1, 2:31 pm, Allan Mullan <[EMAIL PROTECTED]> > > wrote: Hmmm actually I think this may be something to do > > with the width not being defined on the table cells - I > > set it on the first row but then the rest I have left > the table cells to inherit. > > > Allan Mullan wrote: > > > > > Hey Pat, > > > > > Thanks for that, unfortunately howeveer I get a > > > "e.style.has no properties"... I tried changing it to: > > > > > $("td.fillme").each(function() { > > > $(this).html('<input type="text" > > > class="fillmeInput" value="'+$(this).text()+'" > > > style="width:'+$(this).width()+'px;">'); }); > > > > > which works but with completely unexpected results > > > (http://skorpion.geek.nz/cost_process/test.html) > > > > > Seems I underestimated it being such a pain... > > > > > Allan > > > > > patcoll wrote: > > >> It'd probably be something like this: > > > > >> $("td.fillme").html('<input type="text" > > class="fillmeInput" value="'+$ >> (this).text()+'" > style="width:'+$(this).width()+'px;">'); > > > >> This isn't tested but this is the first thing that > > came to mind. Just >> remember to style the input with > > class "fillmeInput" with the font >> size, height of the > text input, a green background, etc. > > > >> Even better, but this into a function. Then make a > > function that >> switches it back to just text in the > > field, saving the changes you >> made. Then have a > button that toggles the "edit mode" of the table. > > > >> Maybe that's where you're going with this :-0 > > > > >> Pat > > > > >> On Aug 1, 6:59 am, Allan Mullan > <[EMAIL PROTECTED]> wrote: > > > >>> Evening all, > > > > >>> I'm trying to get a spreadsheet-like table going > > >>> (http://skorpion.geek.nz/cost_process) and want to > > have the green cells >>> populatated with input fields > > (from there I'm going to work out the >>> math > > >>> in the red cells). > > > > >>> Rather than manually add all the input fields I > > figured I'd use jQuery >>> to do it, which worked - > > except I can't seem to get the width part >>> right > > >>> (I need the width of the input field to be the width > of the cell). > > > >>> Anyone got any suggestions? It's late and my mind's > > gone blank for the >>> moment :-( > > > > >>> Thanks in advance, > > >>> Allan