开发者

JQuery, Insert Text into a TextBox

开发者 https://www.devze.com 2022-12-22 22:24 出处:网络
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\');

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

精彩评论

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