html onclick上的多功能调用 [英] Multiple function call on html onclick
本文介绍了html onclick上的多功能调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能使用 onclick
HTML属性进行调用多个jQuery函数
Is there any possibilities to use the onclick
HTML attribute to call
more than one jQuery functions
onclick="$('#editParentDetailsViews').removeClass('tab selected');$('#editStudentDetailsPopupPnl').hide(); return false;"
在这里,第一个功能正常工作,而第二个功能不工作.
Here, the first function work properly and the 2nd function not working.
推荐答案
我建议您采用以下方式:
I suggest you these ways:
1- addEventListener
:
document.getElementById('btn').addEventListener('click', function(){
function1();
function2();
});
2-inline( onclick
)
onClick="function1();function2();"
3-Jquery标准点击功能:
3-Jquery Standard click function:
$("button").click(function(){
//Your functions code here
});
4-jquery开:
4-Jquery on:
$('#button').on('click',function(){
//Your code here
})
您可以找到更多方法...
You can find more ways...
这篇关于html onclick上的多功能调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文