JS:使用JQuery通过选择类触发方法
Copyright Notice: This article is an original work licensed under the CC 4.0 BY-NC-ND license.
If you wish to repost this article, please include the original source link and this copyright notice.
Source link: https://v2know.com/article/926
JS:使用JQuery通过选择类触发方法
同样,这个也是非常常用的。
HTML部分:
<button class="myButton">点击我</button>
JavaScript部分:
$(document).ready(function(){
$(".myButton").click(function(){
alert("Hello World!");
});
});
This article was last edited at 2023-05-10 06:37:50