Call a javaScript function with arguments in jQuery
I have a javascript function with arguments that 开发者_JS百科I want to call in jQuery and I am stuck.
I tried this : $("a").click(highlight(arg)) but it doesnt work.
Any ideas ?
Johanna
Try this:
$("a").click(function(){
highlight(arg);
});
$('a').click(highlight);
that would be a total bypass.
otherwise:
eg. if you need a specific property of event
$('a').click(function(event) {
highlight(event.specialProp);
});
otherwise:
eg. if you declared args
yourself
var args = 'demoArgs';
$('a').click(function() {
higlhight(args);
});
精彩评论