Friday, May 4, 2018

How change the URL clicking on jquery event?[SOLVED]


Below is the solution for adding URL using jquery event


$("#eventid").click(function() {
window.history.pushState({},'data',baseUrl+'?igq='+keyword+'&program='+program+'&type='+type+'&cat='+encodeURIComponent(CategoriesSelectedData)+'&page='+page); 


}

Friday, March 16, 2018

How to jvalidate the array type input box using jquery[SOLVED]


Hey guy ,

After lot of R&D I have updated the core library for dynamic validation input box for below updated and example , it might be help you for validation.

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.validate.js"></script>

jQuery(function() {

jQuery("#winner_register").validate({
  errorElement: 'small',
  focusInvalid: true,
  invalidHandler: function(form, validator){
   if (!validator.numberOfInvalids())
   return;
   jQuery('html, body').animate({
   scrollTop: jQuery(validator.errorList[0].element).offset().top-300
   }, 100);
  },
  rules: {
   
   'ftk_email[]': {
    required: true,
    email: true,
   }
   
  },
  messages: {
   
   'ftk_email[]': {
    required: "Please enter FTK Email.",
    email: "Please enter a valid FTK Email.",
   }
   
  },
  submitHandler: function(form) {
   customvalidation();
   jQuery('#ajax_check_send').text('Submitting...');
   form.submit();
   jQuery('#ajax_check_send').text('');
   // avoid to execute the actual submit of the form.
  }
 });

});
<form method="post" name="winner_register" id="winner_register" action="" class="form-validate" autocomplete="off" novalidate="novalidate">
<input type="text" class="required form-control" name="ftk_email[]" id="ftk_email_1" value="" title="Please enter FTK Email.">
<small class="error" generated="true" for="ftk_email_1" style="display:none"></small>
<input type="text" class="required form-control" name="ftk_email[]" id="ftk_email_2" value="" title="Please enter FTK Email.">
<small class="error" generated="true" for="ftk_email_2" style="display:none"></small>
 <input type="submit" name="compAdd" value="Submit" title="Submit" id="submitButton" class="create_btn btn-intel btn">
</form>
updated the below code on jquery validate library
jquery.validate.js
checkForm: function() {
    this.prepareForm();
    for (var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++) {
        if (this.findByName(elements[i].name).length != undefined && this.findByName(elements[i].name).length > 1) {
            for (var cnt = 0; cnt < this.findByName(elements[i].name).length; cnt++) {
                this.check(this.findByName(elements[i].name)[cnt]);
            }
        } else {
            this.check(elements[i]);
        }
    }
    return this.valid();
}