事件中的jQuery加载脚本(单击) [英] JQuery load script on event (click)
本文介绍了事件中的jQuery加载脚本(单击)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$('#selector').click(function() {
// here I would like to load a javascript file
// let's say /js/script-on-click-event.js
});
这有可能吗?我不确定,但是我记得在JQuery文档中读到了有关执行此操作的功能的信息,但我在这里找不到它,也许它已被弃用,或者在其他地方看到过?
Is that somehow possible? I'm not sure but I remember reading about a function that does this in JQuery documentation but I cannot find it here, maybe it's been deprecated or I saw it elsewhere?
基本上我想要的是在click事件上加载脚本.
Basically what I want is to load a script on a click event.
推荐答案
$("#selector").click(function(){
$.getScript("http://dev.jquery.com/view/trunk/plugins/color/jquery.color.js");
});
这篇关于事件中的jQuery加载脚本(单击)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文