Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8790887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:46:01+00:00 2026-06-13T22:46:01+00:00

In the code snippet below, I’m trying to prevent the user from entering new

  • 0

In the code snippet below, I’m trying to prevent the user from entering new lines into a <textarea> by using preventDefault(). Instead of entering new lines, I want the enter key to trigger the blur event. However, the code below is bypassing the change event after the user changes the text within the <textarea> and then hits enter. How can I ensure that the change event always fires when the value of the text is changed?

$('textarea')
.keypress(function (event) {
    if (event.which == '13') {//13 = Enter
        event.preventDefault();
        $(this).blur();
    }
})
.change(function() {// THIS DOES NOT FIRE IF USER PRESSES ENTER
    alert('change event');
})
.blur(function() {
    console.log('blur event');
});//end: blur()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:46:02+00:00Added an answer on June 13, 2026 at 10:46 pm

    Looks like it is a problem with the event ordering. In IE change event is fired first then blur event is fired but in Firefox and Chrome it is the opposite. So when you fire blur() event manually in Firefox and Chrome it causes the focus event to fire, but in IE it won’t.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the code snippet below to get user details from a wsdl url
I am using the below code snippet to FTP simple text files from a
I'm using the code snippet below to create a JFormattedTextField. When entering values via
the code snippet below takes an an integer (i.e. number) from the user and
Please see the code snippet below : #include <iostream> using namespace std; int main()
In the code snippet below, from my jQuery setup, I need to check if
In the code snippet below, I am trying to persist two entities - Account
I have below code snippet SimpleDateFormat dateFormat = new SimpleDateFormat( yyyy-MM-dd hh:mm:ss.SSS); String processedContentDate=2012-04-10
See code snippet below, or jsfiddle . What I'm trying to do is type
I am trying to implement the code snippet below. However I am unable to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.