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
精彩评论