我的价值就像20.23。现在我想在两个文本框中分配此值。 [英] I Have A Value Like 20.23. Now I Want Assign This Value In Two Textboxes.
本文介绍了我的价值就像20.23。现在我想在两个文本框中分配此值。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的值为20.23。现在我想在两个文本框中分配此值。即Textbox1值为20,Textbox2值为23.使用Mvc和Jquery如何实现它。我需要示例代码。
提前致谢
问候,
venkat
解决方案
如果值是数字,则必须使用 toString()将其转换为字符串方法 [ ^ ],
使用 split()方法 [ ^ ]将值拆分为2字符串数组。了解: JavaScript中的数组 [ ^ ]
如果您有这样的文本框:
< input type =textid =textbox1>
或使用html助手:
@ Html.TextBox(textbox1)
在jQuery中为其赋值
(#textbox1)。val(值);
了解更多:< a href =http://www.w3schools.com/jquery/jquery_selectors.asp> http://www.w3schools.com/jquery/jquery_selectors.asp [ ^ ]
I have a value like 20.23. Now i want assign this value in two textboxes . That is Textbox1 value is 20 and Textbox2 value is 23. Using Mvc and Jquery how to achieve it. I need sample code.
Thanks in advance
regards,
venkat
解决方案
If the value is a number, it has to be converted to string using toString() Method[^],
Use split() Method[^] to split the value into a 2-string array. Learn about: Arrays in JavaScript[^]
If you have a textbox like this:
<input type="text" id="textbox1">
or with html helper:
@Html.TextBox("textbox1")
To assign a value to it in jQuery
("#textbox1").val("the value");
Learn more: http://www.w3schools.com/jquery/jquery_selectors.asp[^]
这篇关于我的价值就像20.23。现在我想在两个文本框中分配此值。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文