Home > Article > Web Front-end > Solution to ready function conflict in JQuery_jquery
An aspx page can usually contain other ascx controls. If multiple people collaborate on development: programmer Xiao Zhang uses $().ready(function{}) in control A.ascx, and programmer Xiao Wang uses The ready function is also used in the control B.ascx. When the programmer Xiao Li was making the page, he dragged A.ascx and B.ascx into his own page, and then he also needed to use the $().ready function in the page. , now it’s better:
Although the design of jQuery itself is pretty good, after the document is loaded, the functions defined in each ready will be triggered in turn (this is good, unlike the default function of the same name in javascript. overwriting the previous function definition), but what if a programmer wants his own ready part to be executed first (or when the three programmers' respective ready processes are in strict order), what should we do?
In fact, this is not difficult. You can use setTimeOut to delay the execution of the ready part of a programmer