daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function ($) {
  2.     $.validator.addMethod('data-val-more-than',
  3.         function (value, element, params) {                        
  4.             var nameCompare = $(element).attr('data-val-more-than-field');
  5.             if (nameCompare) {
  6.                 var valueCompare = $("#" + nameCompare).val();
  7.                 var valueInitials = parseInt(valueCompare);
  8.                 var valueEnds = parseInt(value);
  9.                 if (valueInitials && valueEnds && (valueInitials <= valueEnds)) {
  10.                     return true;
  11.                 }
  12.             }
  13.             return false;
  14.         }, function (params, element) {            
  15.             var msgCompare = $(element).attr('data-val-more-than');
  16.             if (!msgCompare) {
  17.                 msgCompare = 'ValueEnds less than ValueInitials';
  18.             }
  19.             return msgCompare;
  20.         });
  21.     $.validator.unobtrusive.adapters.addBool('data-val-more-than');
  22. })(jQuery);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top