Using multiple js files
GopeshMedayil No problem! If it helped, could you please mark this as the answer? Ask coding questions. Answered by JustARatherRidi [earned 5 cycles]. View Answer. Now I just have one small problem. I want it within a div not just the body. What do I use instead of body? Show 2 more comments. After seeing some code, one may be able to provide a better answer.
Donald Taylor Donald Taylor 9, 15 15 gold badges 61 61 silver badges 88 88 bronze badges. Tralli Tralli 1 1 gold badge 2 2 silver badges 11 11 bronze badges. ChrisSobolewski im aware of that, its just in the question it is not clear when are the functions called. Sign up or log in Sign up using Google.
Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. This is not a good practice as downloading each external JavaScript file adds another unnecessary http request to slow down the loading of your page.
For example, your mobile web page has 3 external JavaScript files, in which two are in the head section and one is in the body section. The fewer external resources your page requires the web browser to download, the faster the page load speed. Your mobile web page should load faster when the web browser has to download fewer external JavaScript files. To achieve this, you should combine multiple JavaScript files into fewer files or even a single file.
See this post for further discussion and example makefile: Makefile to combine js files and make a compressed version. You can also compress and minify the javascript to further reduce the file size: See Compressed JavaScript or Best JavaScript compressor. Just include both of files to your html page and call functions when you need it. Nothing difficult and hard. Or use two of this functions in one file. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. JavaScript in multiple files Ask Question. Asked 11 years, 10 months ago. Active 8 years, 10 months ago. Viewed 39k times. Here is the code for validators. Add a comment. Active Oldest Votes. Make sure that you include your validators.
Sarfraz Sarfraz k 70 70 gold badges silver badges bronze badges.
0コメント