Wrapping functions around events
Hey Guys. I am new to working with events and I am just curious to know why should we wrap a function around events. Like for example for the code below
- $(function() { $("#evtTarget").on("mouseover mouseleave", highlighted); });
Why can't it just be like this??
- $("#evtTarget").on("mouseover mouseleave", highlighted);
Thanks for your help!