Home > Article > Web Front-end > jquery dynamic loading js/css file method (self-written small function)_jquery
Let’s first look at the getSrcript file that comes with jquery
Method
$.getScript(url,callback)
Example
$(function()
{
$('#loadButton').click(function(){
$.getScript('new.js',function(){
newFun('"Checking new script"');//This function is in new.js. This function is run when click is clicked
});
});
});
The code is as follows