javascript - Override focus method for single element -
i creating custom component needs play nicely native blur , focus functions. trying override these functions provide functionality require.
i able override prototype functions this:
$('div#foo').__proto__.focus = function(msg) { console.log(msg); }
the problem overrides focus function div's. want override function on specific element part of component.
here fiddle kind of showing gist of want do: http://jsfiddle.net/dkrotts/5mxvl/3/
how attaching new focus event , using preventdefault
stop whatever happening.
$('#foo').focus(function(event) { event.preventdefault() // code... }
javascript jquery
No comments:
Post a Comment