Hi there,

I have a function which controls my interface. If people click on a
link with the class 'less' i would like a dive to slide up.
My code roughly looks like this:

$("a.less").livequery( 'click', function() {
        var cur_project_id = ( $(this).closest( "div.project" ).attr
( "id" ) );
        $( "#"+cur_project_id ).closeProject( cur_project_id );
        return false;
});

$.fn.extend({
        closeProject: function( projectID ) {
                        $( "#"+projectID+" .morebody" ).slideUp('normal')
        }
});


It works, but as you can see i pass the object twice to the function,
but i know i shouldn't have to and be able to only write something
like:

$( "#"+$(this).closest( "div.project" ).attr( "id" ) ).closeProject
(); // <-- nothing between last brackets!

I hope this is clear and makes sense!

Thanks in advance,
Knal

Reply via email to