gpt4 book ai didi

javascript - 数字到 Word - jquery

转载 作者:数据小太阳 更新时间:2023-10-29 04:58:33 24 4
gpt4 key购买 nike

有谁知道描述现金值(value)的方法或执行此操作的插件吗?

exp: 如果我有 $1.200.000,00 并且用户 hover() 值:描述将是“一百万

谢谢!

最佳答案

下一页提到了一个非常简单的实现:

Number to Words | Javascript

可以使用这个函数进行转换:

var words = toWords(num);

使用 jQuery,您可以将其包装在悬停函数中,如下所示:

//This will add a tooltip upon hovering with the "word" value.
$('div').hover(function(){
$(this).attr('title',toWords($(this).text()));
});

Working Demo

关于javascript - 数字到 Word - jquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7257575/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com