JSFiddle - React, Tailwind, and code Playground
by mowglisanu
HTML
<input type="text" id="test" />
JavaScript
(function($) {
function onlydigits(e) {
//console.log(e.keyCode);
if ((e.keyCode >= 65 && e.keyCode <= 90) || (e.keyCode >= 106 && e.keyCode <= 111) || e.keyCode == 32 || e.keyCode >= 186) {
return false;
}
}
function keycode(e){
console.log(e);
}
function testpaste(e) {
console.log('p');
console.log(e)
console.log(e);
}
var methods = {
init: function(options) {
var settings = $.extend({
type: 'number',
range: {
lower: 0,
upper: 1000000
}
}, options);
this.data('settings', settings);
this.on('beforepaste paste change', keycode);
//this.on('paste change beforepaste afterpaste', testpaste);
},
destroy: function() {
}
}
$.fn.forms = function(options) {
return methods['init'].apply(this, options);
}
})(jQuery);
$('#test').forms({});