Mayur
Mayur

Reputation: 21

how to get value of contenteditable element into jquery

$("#txt1").change(function()
{
     alert(this.value);
});
<span id="txt1" contenteditable="true"> </span>

I have to work with php and i edit dynamically data into my table like datatable, when change my content nothing event occurred.

Upvotes: 0

Views: 352

Answers (1)

Ander2
Ander2

Reputation: 5658

.change() event is not available for span elements. From jQuery's .change() documentation:

This event is limited to input elements, textarea boxes and select elements. For select boxes, checkboxes, and radio buttons, the event is fired immediately when the user makes a selection with the mouse, but for the other element types the event is deferred until the element loses focus.

Upvotes: 2

Related Questions