user295541
user295541

Reputation: 1015

Span element change event

My question is:

Does have a span element the inner html change event? I think about I have a span and when the span inner html is changing it will throw an event that I can reach?

I would like to use Jquery to bind to this event of span.

l.

Upvotes: 7

Views: 11328

Answers (4)

kennebec
kennebec

Reputation: 104780

Why not handle it when you make the change?

function updateHTML(el,newhtml,callback){
    el.innerHTML=newhtml;
    if(typeof callback=='function')callback(el);
}

Upvotes: 0

GvS
GvS

Reputation: 52518

From the jQuery documentation:

The change event is sent to an element when its value changes. This event is limited to <input> elements, <textarea> boxes and <select> elements.

Upvotes: 6

azatoth
azatoth

Reputation: 2379

At the moment, such events are not supported by browsers like IE, but what you are looking for is DOM events. See https://developer.mozilla.org/en/DOM_Events for more information.

Upvotes: 2

Quentin
Quentin

Reputation: 943591

No. As a rule of thumb, if something internal to a script changes something, it will not trigger an event.

Nothing external to a script can edit the innerHTML of a span (unless, perhaps, it is contentEditable) so there is no event.

Upvotes: 1

Related Questions