Monday 15 March 2010

Javascript/JQuery: Assign a whole line of code to a function parameter? -



Javascript/JQuery: Assign a whole line of code to a function parameter? -

is possible assign whole line of code function parameter? take example:

function testfunc(parameter1){ parameter1; } testfunc($(".someclass").text("sometext"));

when function used parameter, can parameter1 replaced line of code?

i'm new javascript , jquery, i'm curious if possible. did not see questions asked before. if asked, link question appreciated. thanks

sounds inventing callback :)

pass actual function , phone call ();

function testfunc(callback){ callback(); } testfunc(function(){$(".someclass").text("sometext");});

javascript jquery function parameters

No comments:

Post a Comment