Posted May 28, 2014 Can anyone help me? So I have a normal table with inputs inside td's. Now what I want to do is when the tr:last-child>td:first-child>input has something in it, a new row automatically be added. And then when you erase the value of tr:nth-last-child(2)>td:first-child>input, the tr:last-child should be deleted. Somehow the function work except to the dynamically added markups.... http://jsfiddle.net/7XZEV/ CPU: Intel Core i5 3570K ( raped to 4.4Ghz) | Motherboard: Gigabyte GA-Z77X-UD3H | RAM: Corsair Vengeance 8GB | GPU: ASUS GTX 980 Strix Case: Fractal Design DefineR3 | Storage: 256GB Crucial MX100 & 1TB Samsung Whatevs | Display(s): ASUS MG279Q & 1x Cheap LG Shit PSU: Corsair HX650 or something | Cooling: Corsair H80i | Keyboard: Ducky Shine 3 | Mouse: Roccat Kone Pure | Sound: SoundBlaster Recon3D PCI-e Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted May 28, 2014 It can't add the function to things that don't exist yet. You need to add the function to each new element you create or use something like .clone() on the parent element and erase the value in the field. 1474412270.2748842 Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted May 28, 2014 Author It can't add the function to things that don't exist yet. You need to add the function to each new element you create or use something like .clone() on the parent element and erase the value in the field. By saying I need to add the function to each new element, what do you mean by that. I dont have much exp in jquery or javascript in general so if you wouldnt mind telling how to do that I would really appreciate it. And what if I have like a thousand row? Because in the project that Im currently working on right now, that is possible, wont the application become super slow if I add function to each of them? Isnt there any more efficient way to do this? CPU: Intel Core i5 3570K ( raped to 4.4Ghz) | Motherboard: Gigabyte GA-Z77X-UD3H | RAM: Corsair Vengeance 8GB | GPU: ASUS GTX 980 Strix Case: Fractal Design DefineR3 | Storage: 256GB Crucial MX100 & 1TB Samsung Whatevs | Display(s): ASUS MG279Q & 1x Cheap LG Shit PSU: Corsair HX650 or something | Cooling: Corsair H80i | Keyboard: Ducky Shine 3 | Mouse: Roccat Kone Pure | Sound: SoundBlaster Recon3D PCI-e Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted May 28, 2014 Can anyone help me? So I have a normal table with inputs inside td's. Now what I want to do is when the tr:last-child>td:first-child>input has something in it, a new row automatically be added. And then when you erase the value of tr:nth-last-child(2)>td:first-child>input, the tr:last-child should be deleted. Somehow the function work except to the dynamically added markups.... http://jsfiddle.net/7XZEV/ does this mean "i want that when you write in the last row, a new row should appear. then, when a row turns back empty, all the next rows should disappear" ? so, your problem is that your script only works for 1 row? wont the application become super slow if I add function to each of them? there shouldn't be any problem Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted May 28, 2014 Author Well thanks for the help guys but I already figure it out a while ago at work... CPU: Intel Core i5 3570K ( raped to 4.4Ghz) | Motherboard: Gigabyte GA-Z77X-UD3H | RAM: Corsair Vengeance 8GB | GPU: ASUS GTX 980 Strix Case: Fractal Design DefineR3 | Storage: 256GB Crucial MX100 & 1TB Samsung Whatevs | Display(s): ASUS MG279Q & 1x Cheap LG Shit PSU: Corsair HX650 or something | Cooling: Corsair H80i | Keyboard: Ducky Shine 3 | Mouse: Roccat Kone Pure | Sound: SoundBlaster Recon3D PCI-e Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now