C# 如何在 jquery onkeyup 上触发 TextBox.TextChanged 事件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1362284/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 15:39:47  来源:igfitidea点击:

How to fire TextBox.TextChanged event on jquery onkeyup?

c#javascriptasp.netjquery-ui

提问by Pankaj Mishra

I have asp.net TextBox with ontextchanged event this is search text box in my application.

我有带有 ontextchanged 事件的 asp.net TextBox,这是我的应用程序中的搜索文本框。

I have search code in this event. how can I fire this event with the help of j query onkeyup.

我在此事件中有搜索代码。如何在 j query onkeyup 的帮助下触发此事件。

If i enter text in text box it will fire ontextchanged without press enter or mouse.

如果我在文本框中输入文本,它将在不按 Enter 或鼠标的情况下触发 ontextchanged。

This is an example of event what i need. But i dont know how to fire ontextchanged on this.

这是我需要的事件示例。但我不知道如何在这个上触发 ontextchanged。

http://viralpatel.net/blogs/demo/sum-textbox-value-javascript.html

http://viralpatel.net/blogs/demo/sum-textbox-value-javascript.html

采纳答案by h3n

$('#textMessage').keyup(function(event) {
  if (event.keyCode == 13) {
    var message =  $('#textMessage').val();
    alert(message);
  } else {
    return true;
  }
}); //endTextMessage keyup