1

I've have a html input field like:

<input type="text" name="fieldName" onChange="alert(1)" />

onChange event does not trigger on DOM change. Is there any way to detect all changes inline as like onChange mentioned above?

Sampson
  • 259,174
  • 73
  • 529
  • 557
Rejaul
  • 731
  • 1
  • 8
  • 30

1 Answers1

1

With textbox you should use either onkeypress or onkeyup or onkeydown instead of onchange because onchange is triggered only when the textbox is blurred.

<input type="text" name="fieldname" onkeydown="callme(this);" /> <br />

function callme(obj) {
    alert(obj.name); 
}
  • Actually, I don't like to touch the field as I'm not inserting the value manually. – Rejaul Dec 06 '15 at 05:26
  • @Rejaul what you mean by you cannot touch.You should use the events as I said.onchange will not work here would that be select box it would work. –  Dec 06 '15 at 05:30
  • Sorry. I don't like to select the field manually. Value of this field will be given from javascript. – Rejaul Dec 06 '15 at 05:44