add a 'loaded' event to .on() method
Right now, if you want to manipulate dynamically loaded as well as static elements, it's necessary to use
- .on(
- {
- 'DOMnodeInserted',
- function(){
- $(this).css('color','#000');
- }
- },
- '#dynamicElement'
- );
- $('#staticElement').trigger('DOMnodeInserted');
But it would be iffy, since DOMnodeInserted is not consistently supported, and static elements require a .trigger()
It would be nice to be able to simply utilize a generic "load" event that is fired as soon as the element is .ready(), so to speak.
- .on(
- {
- 'load',
- function(){
- $(this).css('color','#000');
- }
- },
- '#dynamicElement, #staticElement'
- );