开发者

JQuery, Insert Text into a TextBox

Let's say I have a TextBox with the value 1000000. How can I 开发者_如何转开发add a period following the 1, so that the output is 1.000000?


var input = $('#yourId');
var text = input.val();
input.val(text.substring(0, 1) + '.' + text.substring(1));

Fiddle answer

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜