I allow the user to add multiple rows of fields, but I do not want to include a delete link on the very first row of fields, so they can’t delete all the fields.
Also, how do I limit it to only 3 rows of fields?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try this fiddle: Fiddle
For the first part of hiding the delete on the first row, I called the following on page load:
Then to make sure they can’t add more than 3 or delete the last one, I’ve added length checks in your
clickmethods, see:Also, on a side note,
liveis deprecated now, so if you’re using jQuery 1.7, change these methods toonor if you’re pre-1.7, usedelegate.