Why there is no jquery version?
See original GitHub issuekind of (+autoUnmask option for numeric):
$('#price,#sum').cleave({ numeral: true, numeralThousandsGroupStyle: 'thousand', autoUnmask: true});
(function($, window, undefined){ 'use strict'
$.fn.cleave = function(opts) {
var defaults = {autoUnmask: false},
options = $.extend(defaults, opts || {});
return this.each(function(){
var cleave = new Cleave('#'+this.id, options), $this = $(this);
$this.data('cleave-auto-unmask', options['autoUnmask']);;
$this.data('cleave',cleave)
});
}
var origGetHook, origSetHook;
if ($.valHooks.input) {
origGetHook = $.valHooks.input.get;
origSetHook = $.valHooks.input.set;
} else {
$.valHooks.input = {};
}
$.valHooks.input.get = function (el) {
var $el = $(el), cleave = $el.data('cleave');
if( cleave ) {
return $el.data('cleave-auto-unmask') ? cleave.getRawValue() : el.value;
} else if( origGetHook ) {
return origGetHook(el);
} else {
return undefined;
}
}
$.valHooks.input.set = function (el,val) {
var $el = $(el), cleave = $el.data('cleave');
if( cleave ) {
cleave.setRawValue(val);
return $el;
} else if( origSetHook ) {
return origSetHook(el);
} else {
return undefined;
}
}
})(jQuery, window);
Issue Analytics
- State:
- Created 5 years ago
- Reactions:17
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Why jQuery is Obsolete and Time to Stop Using It - Love2Dev
What Causes jQuery Version Fragmentation? There is no one single answer to this question as most sites will have more than one reason....
Read more >5 Easy Ways to Fix the "jQuery is Not Defined" Error - Kinsta
The "jQuery is not defined" error means a call for a specific jQuery that wasn't available when the website loaded. Here's how to...
Read more >How to upgrade to the latest version of jQuery
Upgrading to the latest version of jQuery makes your website more secure, and potentially a little faster in terms of script execution time...
Read more >Should You Be Using JQuery 3.4? - Webdesigner Depot
jQuery 3.4 is now publicly available. With a raft of options for JavaScript developers, we ask if there's still room for the original ......
Read more >jQuery version incorrect - UberMenu Troubleshooter Diagnosis
Newer versions of jQuery include functions not available in older versions. If your theme or another plugin loads an older version of jQuery,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The line “var cleave = new Cleave(‘#’+this.id, options), $this = $(this);” should be “var cleave = new Cleave(this, options), $this = $(this);” to be fully compatible, you are otherwise assuming that whatever was passed to the JQuery function has an ID which may or may not be true
Just a minor change for others.