[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1127
  • Last Modified:

Make Enter key invoke onchange event

We have an app where we have a textbox where we have an onchange event. Here is the form code:

<input type="password" style="background color: #FF0000;" name="conf" size="10" class="pt9" disabled="true" onChange="chk_text();">

We want it to be such that if the person types text & hit's the ENTER key it will invoke the onchange event. It does that in FireFox.

How can we make it do that in IE?
Richard Korts
Richard Korts
  • 2
1 Solution
David S.Commented:
Inline events are ugly but try this:

onkeypress="var k=event.keyCode||event.which;if(k==13){this.onchange();}"
Richard KortsAuthor Commented:
To Kravimir:

I'm not clear on where the onkeypress....... goes. Does it go inside the <input type ...> tag?

David S.Commented:
Yes, it would go inside that tag.

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now