2016-09-01 6 views
2

を歪めているが、私のHTMLとJSです:歪んだ日付ピッカーの日付ピッカーが現れているが、その中のカレンダーはここ

<div id="datepicker" class="input-group date" data-date-format="mm-dd-yyyy">       
<label runat="server" for="DOB"></label> 
<input class="form-control" type="text" id="DOB" name="DOB" /> 
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i>      
    </span> 
    </div> 

    $("#datepicker").datepicker({ 
    autoclose: true, 
    todayHighlight: true, 
}).datepicker('update', new Date()).datepicker("setDate", null); 

スクリーンショット It is the screenshot of distorted datepicker

それは完全に以前働いていたが、私は前にいくつかの他のjQueryのコードを追加しましたこのdatepickerコードとそれは動作を停止しました。

+0

あなたの他のjqueryのコードは、いくつかの構文エラーを持っている可能性があります。ブラウザのコンソールでエラーをチェックできますか? –

+0

私はそれを試しましたが、構文エラーはありません。 –

+0

jquery-ui-themeを追加すると思います –

答えて

0
$(document).ready(function() { 


$('#registertn').validate({ 
    rules: { 
     firstname: "required", 
     lastname: "required", 
     instemail: { 
      required: true, 
      email: true 
     }, 

     rollno: { 
      required: true, 
      number: true 
     }, 

     program: { 
      required: true 
     }, 

     specializn: { 
      required: true 
     }, 

     ffirstname: "required", 
     flastname: "required", 
     mfirstname: "required", 
     mlastname: "required", 

     Gender: { 
      required: true 
     }, 

     DOB: "required", 

     category: { 
      required: true 
     }, 

     religion: { 
      required: true 
     }, 

     address: "required", 
     area: "required", 
     state: "required", 
     country: "required", 

     pin: { 
      required: true, 
      number: true, 
      maxlength: 6, 
      minlength: 6 
     }, 

     fmob: { 
      required: true, 
      number: true, 
      maxlength: 10, 
      minlength: 10 
     }, 
     mob: { 
      required: true, 
      number: true, 
      maxlength: 10, 
      minlength: 10 
     }, 

     peid: { 
      required: true, 
      email: true 
     } 
    }, 

    errorPlacement: function (error, element) { 
     if (element.is(":radio")) { 
      error.insertAfter('#radio'); 
     } 
     else { 
      error.insertAfter(element); 
     } 
    }, 



    messages: { 
     firstname: "First Name field cannot be blank!", 
     lastname: "Last Name field cannot be blank!", 
     ffirstname: "First Name field cannot be blank!", 
     flastname: "Last Name field cannot be blank!", 
     mfirstname: "First Name field cannot be blank!", 
     mlastname: "Last Name field cannot be blank!", 
     rollno: { 
      required: "Roll Number/ID field cannot be blank!", 
      number: "Please enter a valid Roll Number!" 
     }, 

     instemail: 
      { 
       required: "Institute Email field cannot be empty!", 
       email: "Please enter a valid email address!" 
      }, 

     program: "Please select a Program!", 
     specializn: "Please select a Specialization!", 
     Gender: "Please select your Gender!", 
     DOB: "Please enter your Date of Birth!", 
     category: "Please select a Category!", 
     religion: "Please select a Religion!", 
     address: "Address field cannot be blank!", 
     area: "Home City field cannot be blank!", 
     state: "Home State field cannot be blank!", 
     country: "Home Country field cannot be blank!", 

     pin: { 
      required: "Home Pin Code field cannot be blank!", 
      number: "Please enter a valid Pin Code!", 
      maxlength: "Maximum number count should not exceed 6!", 
      minlength: "Minimum number count should be 6!" 
     }, 

     fmob: { 
      required: "Please provide your Father's mobile number!", 
      number: "Mobile number should only consists of numbers!", 
      maxlength: "Maximum number count should not exceed 10!", 
      minlength: "Minimum number count should be 10!" 
     }, 

     mob: { 
      required: "Mobile field cannot be blank!", 
      number: "Mobile number should only consists of numbers!", 
      maxlength: "Maximum number count should not exceed 10!", 
      minlength: "Minimum number count should be 10!" 
     }, 

     peid: { 
      required: "Personal Email field cannot be empty!", 
      email: "Please enter a valid email address!" 
     } 
    }, 


    submitHandler: function(form) { 

     //$('#submit').click(function() {  
      var jsondata = {}; 

      jsondata.RollNo = $('#rollno').val(); 
      jsondata.InstituteEmail = $('#instemail').val(); 
      jsondata.Program = $('#program').val(); 
      jsondata.Specialization = $('#specializn').val(); 
      jsondata.StudentFName = $('#firstname').val(); 
      jsondata.StudentMName = $('#midname').val(); 
      jsondata.StudentLName = $('#lastname').val(); 
      jsondata.FatherFName = $('#ffirstname').val(); 
      jsondata.FatherMName = $('#fmidname').val(); 
      jsondata.FatherLName = $('#flastname').val(); 
      jsondata.MotherFName = $('#mfirstname').val(); 
      jsondata.MotherMName = $('#mmidname').val(); 
      jsondata.MotherLName = $('#mlastname').val(); 
      jsondata.Gender = $("input[type='radio'][name='Gender']:checked").val(); 
      jsondata.DOB = $('#DOB').val(); 
      jsondata.Category = $('#category').val(); 
      jsondata.Religion = $('#religion').val(); 
      jsondata.PhysicalyHandicap = $('#ph').val(); 
      jsondata.ColorBlindness = $('#cb').val(); 
      jsondata.BloodGroup = $('#bg').val(); 
      jsondata.ArmedForce = $('#af').val(); 
      jsondata.Address = $('#address').val(); 
      jsondata.HomeCity = $('#area').val(); 
      jsondata.HomeState = $('#state').val(); 
      jsondata.HomePin = $('#pin').val(); 
      jsondata.HomeCountry = $('#country').val(); 
      jsondata.FatherMobile = $('#fmob').val(); 
      jsondata.StudentMobile = $('#mob').val(); 
      jsondata.PersonalEmail = $('#peid').val(); 


      $.ajax({    
       type: "POST", 
       contentType: "application/json; charset=utf-8",      
       url: "WebForm1.aspx/InsertData", 
       datatype: "json", 
       async: false, 
       data:'{ud:' +JSON.stringify(jsondata)+'}', 
       success: function (Record) {       
        if (Record.d == true) { 

         $('#Result').text("Your Record insert").css('background-color','green'); 
        } 
        else { 

         $('#Result').text("Your Record Not Insert").css('background-color','red'); 
        } 

       }, 
       Error: function (textMsg) { 

        $('#Result').text("Error: " + Error); 
       } 
      }); 
    } 
}); 

$("#datepicker").datepicker({ 
    autoclose: true, 
    todayHighlight: true, 
}).datepicker('update', new Date()).datepicker("setDate", null); 

}); 

この私の完全なjqueryのコード

+0

あなたのコードをjsfiddleまたはplunkrで作成すると、助けが簡単になります。 –

+0

最初の日付ピッカー機能を変更するようにしてください –

+0

あなたのお手伝いをしていただきありがとうございます。スクリプトのいくつかを変更しました。 –

関連する問題