$(document).ready(function () {
doSomething(1);
$('#pp').click( doSomething(2) );//why is this called?? I didn't click the button..
});
function doSomething(v) {
alert(v);
}
</script>
<body>
<input type="button" id="pp" value="asdf" />
I need a function to be called on load and click. But somehow doSomething() is called two times on load. What’s going on..??
Change the ready fragment to