Im trying to write a function that when called toggles my 'p' tag.
I know I could use
$(this).click(function(){
// Run my function here
});
But i want it as a function so it can be called and I can use it in multiple projects.
Can anybody see where im going wrong with this?
(function(toggle){
$(this).on("click", function(){
$(this).parent().find('p').slideToggle();
});
})
Here the example code: http://jsfiddle.net/UBaSq/