I have a jsp page with jquery-ui somehow it's taking time to load . I have hide the dom and onload function I am writing the following code
setInterval(function(){
if(typeof jQuery.ui !=undefined )
{
$(document.body).css("visibility", "visible");
}
},5000)
I don't want to run the function once condition get true , how to achieve it
Write your all code inside the:
$( document ).ready(function() {
console.log( "ready!" ); //Here you can put all the code
});
Once you DOM(Document object model) is ready then your js code will run, which is written inside the document ready function.
Put your code inside a $( document ).ready()
block. As shown below.
$( document ).ready(function() { console.log( "ready!" ); });
OR shorthand for $( document ).ready()
$(function() { console.log( "ready!" ); });
You may refer to this documentation for more information. https://learn.jquery.com/using-jquery-core/document-ready/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.