Hi there,
Given the following page:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>A very boring page</title>
</head>
<body>
<button id="myDiv">Click me!</button>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</body>
</html>
If you open it in your browser (Chrome for me) and click on the button, nothing happens.
Then if you open the console by presisng F12 -> Console.
Then copy paste the following code:
> $("#myDiv").on("click", function(){ alert("Yay!"); });
Note: it can be on multiple lines, no problem.
You should see:
[<button id=​"myDiv">​Click me!​</button>​]
Now if you click on the button you will see an alert.
Note: You very probably don’t need the return true
in the code you posted.