Hi @pickme,
Please try with the code below.
function custom_masks_form_fields() {
?>
<script type="text/javascript">
jQuery(document).ready(function($){
$("input[name='money']").attr("type","text").mask("000.000.000.000.000",{reverse:true}).on("blur, keyup, change",function(e){const money=parseInt($(this).val().replace(/\./g,""));if((money * money)==0){$(this).val("");}});
});
</script>
<?php
}
add_action('wp_footer', 'custom_masks_form_fields', 111);
When the value is zero, the script will clear the field.
Thread Starter
pickme
(@pickme)
Hi @ivanpetermann
This code worked as well.
Thank you!
-
This reply was modified 4 years, 1 month ago by
pickme.
Thread Starter
pickme
(@pickme)
Hi @ivanpetermann
Is there a way to set a minimum number and a maximum number, in addition to restricting the entry starting with 0? The code above works for the 0. Below the minimum number, the number may be restricted entry or clear itself. Same for the number above the maximum number.
Thank you
-
This reply was modified 4 years, 1 month ago by
pickme.
-
This reply was modified 4 years, 1 month ago by
pickme.
-
This reply was modified 4 years, 1 month ago by
pickme.