0

I managed by DOM, but has some interactions, I need capture the last change, in div.price-box to to send a post via ajax, if not shoot several ajax post.

Example:

$('.price-box').bind('DOMSubtreeModified', function() {
    alert('test');// display the alert from 5 ~ 9 times on the screen
});

The event .change in div.price-box or span.price does not work.

I would like to get an event that captures the change in price, or by my example only get the last interaction.

1 Answer 1

1

Solution:

$('.price-box').bind('DOMSubtreeModified', HandleDOM_ChangeWithDelay);

var zGbl_DOM_ChangeTimer = null;

function HandleDOM_ChangeWithDelay (zEvent) {
    if (typeof zGbl_DOM_ChangeTimer == "number") {
        clearTimeout (zGbl_DOM_ChangeTimer);
        zGbl_DOM_ChangeTimer = '';
    }
    zGbl_DOM_ChangeTimer= setTimeout (HandleDOM_Change, 0);
}

function HandleDOM_Change () {
    alert('test');
}
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.