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 362345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:14:08+00:00 2026-05-12T13:14:08+00:00

I want to run a function when a user edits the content of a

  • 0

I want to run a function when a user edits the content of a div with contenteditable attribute. What’s the equivalent of an onchange event?

I’m using jQuery so any solutions that uses jQuery is preferred. Thanks!

  • 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-05-12T13:14:08+00:00Added an answer on May 12, 2026 at 1:14 pm

    2022 update

    As pointed out in the comments, this doesn’t answer the question asked, which wanted the equivalent of the change event rather than the input event. However, I’ll leave it here as is.

    Original answer

    I’d suggest attaching listeners to key events fired by the editable element, though you need to be aware that keydown and keypress events are fired before the content itself is changed. This won’t cover every possible means of changing the content: the user can also use cut, copy and paste from the Edit or context browser menus, so you may want to handle the cut copy and paste events too. Also, the user can drop text or other content, so there are more events there (mouseup, for example). You may want to poll the element’s contents as a fallback.

    UPDATE 29 October 2014

    The HTML5 input event is the answer in the long term. At the time of writing, it is supported for contenteditable elements in current Mozilla (from Firefox 14) and WebKit/Blink browsers, but not IE.

    Demo:

    document.getElementById("editor").addEventListener("input", function() {
        console.log("input event fired");
    }, false);
    <div contenteditable="true" id="editor">Please type something in here</div>

    Demo: http://jsfiddle.net/ch6yn/2691/

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

Sidebar

Related Questions

Well i want to input a python function as an input in run time
I want to raise a jQuery Dialog box which has 2 buttons. So that
I want to trigger an ajax request when the user has finished typing in
I'm trying to develop a web application that mainly uses PHP but i'm using
I have just started to create a stored function this is my first time
I'm terribly confused on how I should be writing this function...it basically scores a
I have a user control in .NET 2010. I dragged it on to a
I'm making a wxpython app that I will compile with the various freezing utility
Hi I have a Select list liek so: <select id=cardtype name=cardtype> <option selected='y' value=debit-0.00-50.00>Debit1</option>
I'm not sure how to go about this in ZF. I searched on google

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.