jQuery validator not working

后端 未结 3 1863
别那么骄傲
别那么骄傲 2021-01-17 06:28

I have included jQuery validate for my site for uploading advertisement file.. I don\'t know why but this is not working.

HTML file is as following:

         


        
3条回答
  •  不思量自难忘°
    2021-01-17 07:07

    I think you don't included jQuery and validate libraries because it works fine when you add them in your header

    
    
    

    $().ready(function(){
    $("#formToPushAd").validate({
        rules:{
            file:{
                required:true
            },
            adUrl:{
                required:true,
                url:true
            },
            datepicker1:{
                required:true,
                date:true
            },
            datepicker2:{
                required:true,
                date:true,
            }
        },
        messages:{      
            file:{
                required:"Please Select a frequency"
            },
            adUrl:{
                required:"Please enter ad url"
            },
            datepicker1:{
                required:"Please Enter a date",
                date:"Please Enter a valid date"    
            },
            datepicker2:{
                required:"Please Enter a date",
                date:"Please Enter a valid date"
            }
        }
    
    })
    });
    
    
    

    提交回复
    热议问题
    Ad Image:
    Ad URL:
    Starting Date:
    Ending Date: