inject code to $(document).ready()
Added by Sergey Bryukov over 11 years ago
Hello, web designer gave me set of HTML+CSS+Js.
JavaScript comes within *.js file and loaded by tag
in HTML file
this *.js has one function defined $(document).ready(function(){ .... });
Is there technique to inject castom JS into $(document).ready(){} or
own JS have to be inserted into Boot.html:
$(document).ready(function() {
Wt.p.load(true);
[OWN_JS_CODE]
});
Replies (1)
RE: inject code to $(document).ready() - Added by Koen Deforche over 11 years ago
Hey,
You can use WApplication::require(): this will run the JS after the DOM is ready.
I'm not sure how $(document).ready() behaves when you call if after the DOM is ready --- but you may need to remove this and call the function directly.
Unless you are using progressive bootstrap, then you can use this JS file as is with require() as it will be included in the initial HTML response.
Regards,
koen