asing function with parameters to onclick an div
Hi there.
I love jQuery, but now I reached a line, where I cannot solve the problem.
I have some div-Containers which should call a function when they are clicked. So far so easy. They are named with a name + number, that works also. But how can I give different parameters to the called function?
-
for (var j = 0; j < i; j++) {
-
currentDate = new Date( [.......]);
-
$('#foo' + j + 'graph').unbind();
-
$(''#foo' + j + 'graph'').attr('onclick', 'functionName(' + currentDate.getUTCFullYear() + ', ' + (currentDate.getUTCMonth() + 1) + ', ' + currentDate.getUTCDate() + ');');
-
}
This works only in Opera 10.5.
I also tried different other functions like .click() or bind() but they do not work in any browser.
The problem is, that "currentDate" only exist when I bind the function...so it has to bind
-
"functionName(2010,4,6)"
for example, so that the HTML-Code would be
- <div id="foo5graph" onclick="functionName(2010,4,6)">....</div>
Can you please help me?