Javascript, Jquery append functions to an event -
i have function associated event, onfocus() , in cases, want able execute default function 1 or more additional functions.
so don't want replace original function, want append both functions fire.
<div id="mydiv" onfocus="alert('hello');"> if(something == somethingelse) $('#mydiv').onfocus += "alert('world');" so in example, hello fire , hello , world both fire.
i'm using onfocus() , alert() example, these functions have defined.
how go doing ?
use jquery add focus event handler
<script> $('#mydiv').on('focus', function(){ //do soemthing }) </script>
Comments
Post a Comment