Please see the “red box” below.
My clients will fill a value in this box. For example: USD 100,000.00
When my client to fill this box with the value, for exemplo 100000 this box automatically will fill USD 100,000.00.
How do I it? Do I need to put a attribute?
What atribute code?
Here is the script you’d need to add to your footer for the commas to auto populate (need to put in the right ID I believe). I’m trying to find one to add the “.00” at the end of the value.
<script>
$(document).ready(function(){
$('input.number').keyup(function(event){
// skip for arrow keys
if(event.which >= 37 && event.which <= 40){
event.preventDefault();
}
var $this = $(this);
var num = $this.val().replace(/,/gi, "").split("").reverse().join("");
var num2 = RemoveRougeChar(num.replace(/(.{3})/g,"$1,").split("").reverse().join(""));
$this.val(num2);});});
function RemoveRougeChar(convertString){
if(convertString.substring(0,1) == ","){
return convertString.substring(1, convertString.length)
}
return convertString;
}</script>
@CC3008 can you please post the code into the page level of your site? It will be easier to pull from there, the ID you’d insert is: VALOR-M-XIMO-4
And it looks like the code needs some updating as you all use decimals rather than commas between three digit fields.
Let me know once you’ve added the updated code into your footer of the home page. (Go to page, page settings and scroll down to add custom code at the page level rather than at the site level).
Hello @CC3008 doing well thank you, sorry I missed this before! You’ll actually want to go to your page, then page settings and paste in the code in the before tag custom code section.
Once you’ve done this can you please publish the page, then send me a link to the live page?
This will make the jQuery code look for the input field with that ID whenever a number is typed into that field.
Also, try learning jQuery. It’s a fun and fascinating way to get more out of your Webflow site. When Webflow can’t do exactly what you want, you can add your own custom code.