I have this function in my code which works as a slider for elements within a class.
I want to setInterval to it on click event but keeps giving me function is undefined.  
Here is my Script:
$(document).ready(function(){
    $(".slide").click(
        setInterval( function fadeNext() {
            $(this).children('div:nth(0)').children('img:nth(0)').fadeOut().appendTo($(this).children("div:nth(1)"));
            $(this).children("div:nth(1)").children('img:nth(0)').fadeIn().appendTo($(this).children("div:nth(0)"));
        },1000)
    );
});
 
     
     
    