Showing posts with label Imprtant Javascript Code. Show all posts
Showing posts with label Imprtant Javascript Code. Show all posts

Important jQuery and Javascript Code for Project

JQuery and Javascript Code Snippet


$("#fee_exp").change(function(){
   if ($(this).val() == 'Y') {
     $("#check").removeClass('hide');
     $("#check1").addClass('required');
   }else{
     $("#check").addClass('hide');
     $("#check1").removeClass('required');
   }
});


          function submitform()
              {
                $('#registeration').find('form').submit();
                $('.clearFields').val('');
               }



$('#splitPayment input:radio').change(function() {
    if ($(this).val() === 'Y') {
       $('#accountDetail').removeClass('hide');
       $('#primary_account').addClass('required');
       $('#additional_account').addClass('required');

    } else if ($(this).val() === 'N') {
           $('#accountDetail').addClass('hide');
           $('#primary_account').removeClass('required');
    $('#additional_account').removeClass('required');
    $('#primary_account').val("");
    $('#additional_account').val("");
    }
 });



/*Input Field Validation */

 $(".nameclass").on('input', function(event) {
  var regexp = /[^a-zA-Z @]/g;
   if($(this).val().match(regexp)){
     $(this).val( $(this).val().replace(regexp,'') );
   }
 });

 $(".initials").on('input', function(event) {
  var regexp = /[^a-zA-Z .]/g;
   if($(this).val().match(regexp)){
     $(this).val( $(this).val().replace(regexp,'') );
   }
 });

 $(".address").on('input', function(event) {
  var regexp = /[^a-zA-Z0-9 /,]/g;
   if($(this).val().match(regexp)){
     $(this).val( $(this).val().replace(regexp,'') );
   }
 });

 $(".textonly").on('input', function(event) {
  var regexp = /[^a-zA-Z]/g;
   if($(this).val().match(regexp)){
     $(this).val( $(this).val().replace(regexp,'') );
   }
 });
 
 $(".textnumber").on('input', function(event) {
  var regexp = /[^a-zA-Z0-9]/g;
   if($(this).val().match(regexp)){
     $(this).val( $(this).val().replace(regexp,'') );
   }
 });
 
 $(".numberonly").on('input', function(event) {
  var regexp = /[^0-9]/g;
   if($(this).val().match(regexp)){
     $(this).val( $(this).val().replace(regexp,'') );
   }
 });

 $(".onlytextspace").on('input', function(event) {
   var regexp = /[^a-zA-Z\s]+$/g;  
   if($(this).val().match(regexp)){
     $(this).val( $(this).val().replace(regexp,'') );
   }
 }); 

 $(".onlydottextspace").on('input', function(event) {
     //var regexp = /^([\s\.]?[a-zA-Z0-9]+)+$/;
  var regexp = /[^,/0-9a-zA-Z\s\.]+$/g;  
   if($(this).val().match(regexp)){
     $(this).val( $(this).val().replace(regexp,'') );
   }
 });



$(document).ready(function(){
 
 $('#class_id').change(function(){
 var classId = $('#class_id').val();

 $.ajax({      
   url: base_url+base_path+"/get-subject-list",
   type: "post",
   data: { classId : classId },
   dataType: "json",
   
  success: function(data){
     $("#subject_id").empty();
     $("#subject_id").append('<option>Select Subject</option>');
     $.each(data,function(key,value){
     $("#subject_id").append('<option value="'+key+'">'+value+'</option>');
    });
   }
  });
 });
     
});





$('#edudist_name').click(function(){
    
   var edudistId = $('#edudist_name').val();  
   var edudist=[];
   
  $.ajax({      
    url: base_url+base_path+"/check-rev-school",
    type: "post",
    data: { edudistId : edudistId },
    dataType: "json",
    
   success: function(data){
      $("#camp_id").empty();
      $("#camp_id").append('<option>Select</option>');
      $.each(data,function(key,value){
      $("#camp_id").append('<option value="'+key+'">'+value+'</option>');
       edudist.push(key);
       });
        $("#edudist_name").append('<option value="'+edudist.join()+'"> ALL </option>');
     }
   });
 });



       $("#date1").datepicker({
            dateFormat: "dd-mm-yy",
            maxDate : 0, 
            onSelect: function (date) {
                var dt1 = $('#date1').datepicker('getDate');
                var dt2 = $('#date2').datepicker('getDate');
                
                $('#date2').datepicker('option', 'minDate', dt1);
            }
        });
        $('#date2').datepicker({
            dateFormat: "dd-mm-yy",
            maxDate : 0, 
            minDate: $('#date1').datepicker('getDate'),
            onClose: function () {
                var dt1 = $('#date1').datepicker('getDate');
                var dt2 = $('#date2').datepicker('getDate');
                //check to prevent a user from entering a date below date of dt1
                if (dt2 <= dt1) {
                    var minDate = $('#date2').datepicker('option', 'minDate');
                    $('#date2').datepicker('setDate', minDate);
                }
            }
          });      
 });

Our Feature Post

There is a tree between houses of A and B If the tree leans on As House

    There is a tree between houses of A and B. If the tree There is a tree between houses of A and B. If the tree leans on A’s House, the t...

Our Popular Post