Hello, how are you? I have a problem that has already consumed me a lot of time, I'm trying to put a mask for time in an input field, the code is already ok and working the problem is when I import the js library inside the head of my header.php, because buga the rest of my whole site, tried some ways to import but nothing so far solved, tried the following ways:
var mask = function (val) {
val = val.split(":");
return (parseInt(val[0]) > 19)? "HZ:M0" : "H0:M0";
}
pattern = {
onKeyPress: function(val, e, field, options) {
field.mask(mask.apply({}, arguments), options);
},
translation: {
'H': { pattern: /[0-2]/, optional: false },
'Z': { pattern: /[0-3]/, optional: false },
'M': { pattern: /[0-5]/, optional: false }
},
placeholder: 'hh:mm'
};
var $a = jQuery.noConflict()
$a(document).ready(function () {
$a("#QuantidadeHoras").mask(mask, pattern);
});
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js');
wp_enqueue_script( 'jquery' );
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.0/jquery.mask.min.js');
wp_enqueue_script( 'jquery' );