Access inline event object function body without 'function' constructor javascript -


i filtering bunch of objects using jquery, , want have access function body of event without function constructor attached it. i'll show mean:

 $('li').filter(function(){         return this.onmouseout !== null;         })         .each(function(){                console.log(this.onmouseout);         }); 

what get's returned is:

    function onmouseout(event) {          goodsearchbadgehidemenu('120');     } 

what returned is:

    goodsearchbadgehidemenu('120');      \\notice absence of 'function onmouseout(event)' , closing bracket 

i'm sure use string.replace() parse this, want know if function body accessible somewhere in element's attributes or in event object.

thanks

because you're attaching handlers element attributes, can use .getattribute() retrieve body set.

this.getattribute("onmouseout"); 

so...

 $('li').filter(function(){             return this.onmouseout !== null;         })         .each(function(){             console.log(this.getattribute("onmouseout"));         }); 

Comments

Popular posts from this blog

Line ending issue with Mercurial or Visual Studio -

python - Received unregistered task using Celery with Django -

c# - Delving into the world of XML (Windows Phone) Error I dont understand (The ' ' character, hexadecimal value 0x20, cannot be included in a name.) -