Skip to content Skip to sidebar Skip to footer

Is Dom Manipulation (with Jquery Or Else) Async?

I am using selectWithCircle function to select elements with jQuery and add a class 'active' to them. var selectWithCircle = function(el){ if(!el.hasClass('active')){ e

Solution 1:

Setting the value of an input is synchronous. You will reliably get the updated value, cross-browser. Other DOM manipulations like inserting elements, removing them, moving them are also synchronous, although the user may not see the result until your JavaScript code completes, letting the browser use the thread to repaint the display.

And your code is works fine

Solution 2:

JQuery is synchronous and single-threaded. If you run your code, the other will wait for it to success.

JQuery is only asynchronous in Ajax calls and it will not interrupt any other code that's currently running. Except the async: false option

Solution 3:

Yes, jQuery selection and decoration is done synchronously. Also all DOM manipulation is synchronous even if it may feel it isn't.

Post a Comment for "Is Dom Manipulation (with Jquery Or Else) Async?"