Hey guys am new to javascript.I was wondering about how can i get the number of clicks in a paragraph with the onClick method in javascript.
The code i have used is
<html>
<body>
<p id="avalue"> kdfbkjdf </p>
<script>
var a = document.getElementById('avalue');
a.onClick = function(b) {
console.log(b);
}
</script>
</body>
</html>
This code doesnt show any errors but when i clicked the paragraph i didnt get the clicked numbers.
How can i acheive with onclick method ??..
Any help would be appreciated
onClickshould beonclick.