s j s j - 10 months ago 40
Javascript Question

Jquery/javascript function issue

I have a javascript function doing some animation and its parameter is a parent selector.

function myFunction(a)
$("'"+a+">#one'").stop(true, true).animate({left:'30px'},1100);
$("'"+a+">#two'").stop(true, true).animate({left:'30px'},1100);

and the following line is calling that function.


but this is not working, can anyone tell me whats wrong in my code ?



function myFunction(a){
    $(a+">#one").stop().animate({left:30},1100); // <-- fixed selectors

$("#main").mouseleave(function(){ // <-- (immediate call: Wrong)
  myFunction("#main");            // <-- fn reference: OK!