I need some help passing arguments to a jquery function. I have an html header, with
onclick="slide(#aboutit);"
and I created, in the header, a function
<script type="text/javascript">
function slide(element){
var slid = element;
slid.slideToggle("slow");
}
</script>
for some reason which I don’t understand, this isn’t working. I can get it do work if instead of that I use
function slide(){
$('#aboutit').slideToggle("slow");
}
but I don’t want to have to create a new function for sliding for each part of the website.
Thanks in advance.
Your code
slide(#aboutit);is invalid. What you can do instead isslide($('#aboutit')).