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

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -