質問

I have a textbox and I want a JavaScript to run each time the user changes the text of the textbox.

So I used an ontextChanged as follows

@Html.TextBoxFor(m => m.OuterCaseWSP, new
{
      @style = "max-width:145px;",
      @disabled = "disabled", 
      OnTextChanged = "calculateOuterCasePOR()"
}) 

However this does not seem to work.

NOTE: When I replace the OntextChanged with onBlur the code triggers.

What is wrong with the event handler I called ?

役に立ちましたか?

解決

input does not have a textChanged event. There is a change though, but it will be triggered only when text bpx is blurred, so it is not of a value fo you. However you might want to use onKeyPress instead:

onKeyPress = "calculateOuterCasePOR()"
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top