Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fire TextBox.TextChanged event on jquery onkeyup?

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

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

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

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

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

like image 654
Pankaj Mishra Avatar asked Sep 01 '09 12:09

Pankaj Mishra


People also ask

Why is Keyup not working?

keyup / keydown seem to only work on elements that are present at document. ready . If you are triggering your event from elements that were altered or injected post pageload, these events will not fire.

What is Keyup event?

The keyup event is sent to an element when the user releases a key on the keyboard. It can be attached to any element, but the event is only sent to the element that has the focus. Focusable elements can vary between browsers, but form elements can always get focus so are reasonable candidates for this event type.


1 Answers

$('#textMessage').keyup(function(event) {
  if (event.keyCode == 13) {
    var message =  $('#textMessage').val();
    alert(message);
  } else {
    return true;
  }
}); //endTextMessage keyup
like image 133
h3n Avatar answered Sep 25 '22 21:09

h3n