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.
Yes, you can call two JS Function on one onClick.
The first solution to perform multiple onClick events in React is to include all of your actions inside of a function and then call that single function from the onClick event handler. Let's explore how to do that in a React Component: import React from 'react'; function App() { function greeting() { console.
So the answer is - yes you can :) However, I'd recommend to use unobtrusive JavaScript.. mixing js with HTML is just nasty. Save this answer.
I suggest you these ways:
1-addEventListener
:
document.getElementById('btn').addEventListener('click', function(){
function1();
function2();
});
2-inline (onclick
)
onClick="function1();function2();"
3-Jquery Standard click function:
$("button").click(function(){
//Your functions code here
});
4-Jquery on:
$('#button').on('click',function(){
//Your code here
})
You can find more ways...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With