You could use prototype custom events. See example here: http://jsbin.com/ayiku
But you will have to fire function manually after update or override default Element.update function to do it for you. Marko On Sep 2, 7:30 pm, Hipnotik <[email protected]> wrote: > Thanks Walter! > I would like to avoid of using PE and global variable to store current > innerHTML. I thought that it will be quiet easy and any trick can help > me... > There is other way - hidden form field and prototype's observer. But > this solution doesn't satisfy me too. > > Anyway, thanks. > > On 2 Wrz, 17:30, Walter Lee Davis <[email protected]> wrote: > > > There's no reliable cross-browser event that gets fired when the > > content of a DIV (as opposed to a form element, say) changes. One > > thing you might try would be to have a PeriodicalExecuter running. > > Have it compare a global variable with the current innerHTML of that > > DIV, and if they don't match, fire the event and update the global > > variable. This may be more difficult than I am saying it here, it's > > often quite hard to get a PE to gather an external variable value more > > than once (at the moment the PE function is instantiated). > > > Walter > > > On Sep 2, 2009, at 10:07 AM, Hipnotik wrote: > > > > Hi > > > How to call some action if content of the div element has changed? > > > > I'm talking about something like this: > > > $("my-div").observe("change", function(e) { > > > alert("hello"); > > > }); > > > > Expecting behavior: > > > I have this > > > <div id="my-div">some text</div> > > > > now I'm changing "some text" to "some other text" and "alert("hello")" > > > should be fired. > > > > Thnaks for help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
