0

Below is a series of events that should run as listed, but I used a timer to delay the events, which is not a good practice, is there a way to run them after each other without the delay timer?

$(".component-select",closestTable).val(parseData.component).trigger("change");

setTimeout(function() {
    $(".key-select",closestTable).val(parseData.key).trigger("change");
},1000);  

setTimeout(function() {                                                 
    $.each(parseData.instance, function (dIndex, dValue){                             
        $(".add_instance",closestTable).trigger("click");
        $("tbody select:last",closestTable).val(dValue).trigger("change");
    });
},1500);
0

1 Answer 1

1

You might be able to use jQuery deferred promises

another potentially useful resource:

http://net.tutsplus.com/tutorials/javascript-ajax/wrangle-async-tasks-with-jquery-promises/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.