Anything that a jQuery object returns can be used to chain. In general, everything returns a jQuery object, so if the API does not explicitly say that it is not, it is possible that a particular method returns a jQuery object and can be bound.
In the case of events, yes, they return a jQuery object and can be chained. Look here
In your case, you can make an external function that takes a single parameter, the object in which the event occurred, and then check its length or whatever you want to do. Then you just call mouseUp(myFunction).mouseOut(myFunction).keyPress(myFunction) or something else that you want to combine together.
Here is a more explicit example:
<script language="javascript" type="text/javascript"> $(document).ready( function () { setMaxLength(); $("textarea.checkMax").keyup(checkMaxLength()). mouseover(checkMaxLength(this.id)); }); </script>
cdeszaq
source share