jquery validate plugin on dynamic form inputs not working


$("#coach-profile form").validate({
        rules: {
            "signupcoachform-zip":{
                required:true
            }
        },
        messages: {
            "Activity[activity_id][]": "At least one Activity must be selected",
        },
        errorPlacement: function(error,element){
   
        }
    });

below code needs to be in loop where your dynamic fields are genrated with JS

$('input[name="dynamic_field[activity_&_insurance]['+ activity_id +'][from]"]').rules("add", {
            required: true
        });
        
        $('input[name="dynamic_field[activity_&_insurance]['+ activity_id +'][to]"]').rules("add", {
            required: true
        });