The properties and methods added internally to the window object cannot be obtained outside the jquery ready function.

Code:

$(function(){

window.a=function(){}
window.a//Function

})

window.a//undefined

Why can"t properties be added internally to the window object? What should I do if I want to expose some methods to external calls?

Mar.13,2021

DMO loading process:

Web page document loading is performed sequentially. The general order of browser rendering operation is roughly the following steps:

1. Parsing HTML structure

2. Load external scripts and stylesheet files

3. Parse and execute the script code-this is where window.xxx is called externally

4. Construct the HTML DOM model-this is where the ready function is executed, that is, window.xxx has been called before the ready function is executed, so an error will be reported

5. Load external files such as pictures

6. Page loaded

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e47a5a-43fa6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e47a5a-43fa6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?