Correct jQuery: Click Event Handler using Named Functions


Assigning event handlers is fundamental to jQuery and one of the more common reasons for leveraging this toolset. Most tutorials / examples, even in the primary documentation, implement event handlers using anonymous functions instead of named functions – which is great for a crash-course on getting started, but less helpful in real-world development. So here is a quick-reference for using jQuery event handlers with named functions.

<script type="text/javascript">

function handler(e) {
var i = $(this);

Leave a Reply

Your email address will not be published. Required fields are marked *