I am using jQuery v1.7.1 and binding events to elements as in the following example:
<input id="testTextBox" name="testTextBox" type="text" value="" />
<script type="text/javascript">
function evtHandler() {
alert("Event fired!");
}
$(function() {
$("#testTextBox").bind("change", evtHandler);
});
</script>
Obviously my page has a lot more controls than this, including some Ajax to replace parts of the page. So during testing I would like to have a simple way to see if events bound successfully. I know I can check $("#testTextBox").length
before binding to determine if the control was found, but is that the best and only way?