+ 1
How To Link A .js File To HTML file.
I'm using Brackets, and I tried using inline JS and it didn't work, so I migrated the script to a new document because the HTML file was getting cluttered anyway. How do I link it?
4 ответов
+ 3
<script src='myjs.js'></script>
+ 4
<script src="script.js"></script>
Using native JS, but if you wanna include a file using JQuery you can try:
jQuery.getScript() function
Usage:
$(selector).getScript(url,success(response,status))
Example:
$("button").click(function(){
$.getScript("demo_ajax_script.js");
});
0
Does that work with jQuery as well?
0
I'm not sure, I don't know jQuery. Probably you can do:
<script src=jquery></script>
<script src="myjs.js"></script>