2
For example when I want to do an event at the click of the button I can do it in two ways:
using the onclick attribute of Html5 <button type='button' onclick='myFunction()' id='btn0'>O</button>
or by the js :
$('#btn0').click(function(){
myFunction();
});
there are situations that occur the use of the two ways as for example:
<form>
<input type="checkbox" id="myCheck" onmouseover="myFunction()" onclick="alert('click event occured')">
</form>
<script>
function myFunction() {
document.getElementById("myCheck").click();
}
</script>
Is this a good mix? What is the right way to develop and why? , what is the difference of using one or the other? if possible what are the advantages and disadvantages?