im trying to pass paramaters to a function i.e.
animateDiv(div) {
.....
}
this function works, but when i try to pass parameters to it like this, it deosnt work i.e.
$activeToggle.toggle("slow", function(){
$(this).find(".anime_yellow").each(function (i,e){
console.log(e.id); // this prints simple
animateDiv(simple); // this works
animateDiv(e.id); //this deosnt work but it prints 'simple'
});
when i pass hardcore values into the function it works i.e. animateDiv(simple) , if i try to put a variable which holds the same thing, it deosnt work animateDiv(e.id), thanks
the full code is here: http://jsfiddle.net/Fwhtv/22/
Your
animateDivis assuming you’ll pass in an object. Note the following lines:If you wanted to pass in an
id, you’d have to change that to:And of course update other references to
div.idas well.Working: http://jsfiddle.net/Fwhtv/22/