 $('#default-datepicker').datepicker({
        todayHighlight: true
      });
      $('#autoclose-datepicker').datepicker({
        autoclose: true,
        todayHighlight: true
      });

      $('#inline-datepicker').datepicker({
         todayHighlight: true
      });

      $('#dateragne-picker .input-daterange').datepicker({
       });

        $(document).ready(function() {
			$('#default-datatable').DataTable({
				   'aoColumnDefs': [{
						'bSortable': false,
						'aTargets': 'nosort'
					}]
				});           
				
		   $('.single-select').select2();
      
            $('.multiple-select').select2();

        //multiselect start

            $('#my_multi_select1').multiSelect();
            $('#my_multi_select2').multiSelect({
                selectableOptgroup: true
            });

            $('#my_multi_select3').multiSelect({
                selectableHeader: "<input type='text' class='form-control search-input' autocomplete='off' placeholder='search...'>",
                selectionHeader: "<input type='text' class='form-control search-input' autocomplete='off' placeholder='search...'>",
                afterInit: function (ms) {
                    var that = this,
                        $selectableSearch = that.$selectableUl.prev(),
                        $selectionSearch = that.$selectionUl.prev(),
                        selectableSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selectable:not(.ms-selected)',
                        selectionSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selection.ms-selected';

                    that.qs1 = $selectableSearch.quicksearch(selectableSearchString)
                        .on('keydown', function (e) {
                            if (e.which === 40) {
                                that.$selectableUl.focus();
                                return false;
                            }
                        });

                    that.qs2 = $selectionSearch.quicksearch(selectionSearchString)
                        .on('keydown', function (e) {
                            if (e.which == 40) {
                                that.$selectionUl.focus();
                                return false;
                            }
                        });
                },
                afterSelect: function () {
                    this.qs1.cache();
                    this.qs2.cache();
                },
                afterDeselect: function () {
                    this.qs1.cache();
                    this.qs2.cache();
                }
            });

         $('.custom-header').multiSelect({
              selectableHeader: "<div class='custom-header'>Selectable items</div>",
              selectionHeader: "<div class='custom-header'>Selection items</div>",
              selectableFooter: "<div class='custom-header'>Selectable footer</div>",
              selectionFooter: "<div class='custom-header'>Selection footer</div>"
            });


          });


		
(function($) {
  $.fn.inputFilter = function(inputFilter) {
    return this.on("input keydown keyup mousedown mouseup select contextmenu drop", function() {
      if (inputFilter(this.value)) {
        this.oldValue = this.value;
        this.oldSelectionStart = this.selectionStart;
        this.oldSelectionEnd = this.selectionEnd;
      } else if (this.hasOwnProperty("oldValue")) {
        this.value = this.oldValue;
        this.setSelectionRange(this.oldSelectionStart, this.oldSelectionEnd);
      } else {
        this.value = "";
      }
    });
  };
}(jQuery));

$(document).ready(function() {
  $(".onlynum").inputFilter(function(value) {
    return /^\d*$/.test(value);    // Allow digits only, using a RegExp
  });
});		


function getcountry(){
 	var country_id=0;
	$.ajax({
    url:baseurl+"helper/fetch_country",
    method:"POST",
    data:{country_id:country_id},
    success:function(data)
    {
     $('#getcountry').html(data);
    }
   });
 }
 
$(document).ready(function(){
 
 $( window ).on( 'load',function(){
	var country_id=0;
	$.ajax({
    	url:baseurl+"helper/fetch_country",
    	method:"POST",
    	data:{country_id:country_id},
    	success:function(data)
    {
     $('#getcountry').html(data);
    }
   });
 });
 
 $('#getcountry').change(function(){
  var country_id = $('#getcountry').val();
  if(country_id != '')
  {
   $.ajax({
    url:baseurl+"helper/fetch_state",
    method:"POST",
    data:{country_id:country_id},
    success:function(data)
    {
     $('#getstate').html(data);
     $('#getcity').html('<option value="">Select City</option>');
    }
   });
  }
  else
  {
   $('#getstate').html('<option value="">Select State</option>');
   $('#getcity').html('<option value="">Select City</option>');
  }
 });

 $('#getstate').change(function(){
  var state_id = $('#getstate').val();
  if(state_id != '')
  {
   $.ajax({
    url:baseurl+"helper/fetch_city",
    method:"POST",
    data:{state_id:state_id},
    success:function(data)
    {
     $('#getcity').html(data);
    }
   });
  }
  else
  {
   $('#getcity').html('<option value="">Select City</option>');
  }
 });
 
});