How to find the closest element using jquery

  1. initially i have a row if the user click save & next button it will say you have 3 fields missing

  2. if the user click the addmore button and he did not type any value in the text field then he click the save and next button it should still say 3 fields missing

  3. if the user type any one of the field in the cloned row then he click the save and next button validation should happen with my code first two points are working

but the problem is if the user click some more rows and he type in any one of the cloned field then if he click safe and next button the required_Field class was applying in all other field but it should apply only to that row :frowning:

If we can able to find the closest element of the field where the user type then i can able to add required_Field class to those element only

Use the .closest method


I have used that to but no result :frowning:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.