文本框Keypress事件 [英] Textbox Keypress Event

查看:186
本文介绍了文本框Keypress事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





在asp.net中,我有2个文本框控件。其中,我将输入值并按下它的按键值,我必须显示金额。



使用Javascript函数。



第一次按键时,事件被调用,但第二个文本框中没有显示任何值。



按第二个数字按键,显示第一个输入数字的值...



我不明白为什么在第一次,它没有显示值eventhough脚本函数被调用.. 。



任何人都可以指导我解决这个问题



代码



< input type =textid = txt1 />

< input type =textid = txt2 /> ;



$('#txt1')。keypress(function()

{

$(' #txt2')。val()= $('#txt1')。val();



});











谢谢。

解决方案
( #txt1')。keypress(function()

{


('#txt2')。val()=


( '#TXT1')VAL();



});











谢谢。


Hi,

In asp.net , i have 2 textbox control. In which, i will enter the value and on it key pressed value, i have to display the amount.

Used Javascript function.

On first key press , the event called, but no value is displaying in the second textbox.

On second number key press, showing the value for the first typed number...

I don't understand why on very first time, it is not showing the value eventhough script function is called...

Can anybody guide me to solve this issue

Code

<input type="text" id=txt1 />
<input type="text" id=txt2 />

$('#txt1').keypress(function ()
{
$('#txt2').val()=$('#txt1').val();

});





Thanks.

解决方案

('#txt1').keypress(function ()
{


('#txt2').val()=


('#txt1').val();

});





Thanks.


这篇关于文本框Keypress事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆