使用JQuery/Javascript在单个事件上实现多种功能 [英] Multiple Functions on a Single Event with JQuery/Javascript

查看:62
本文介绍了使用JQuery/Javascript在单个事件上实现多种功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在单击事件中调用两个函数的最佳方法是什么?

What is the best way to call two functions upon a single click event?

将有多个元素需要此脚本,因此该脚本必须仅对被单击的元素起作用-并非一次所有元素.

There will be multiple elements requiring this script, so the script must act only upon the element being clicked — not all the elements at once.

让我知道是否需要提供更多详细信息.再次感谢您的所有帮助.

Let me know if I need to provide more details. Thanks again for all your help.

推荐答案

$(function() {
    $('a').click(function() {
        func1();
        func2();
    });
});

这篇关于使用JQuery/Javascript在单个事件上实现多种功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆