I have date value
for(i=0;i<data[\'before\'].length;i++) {
var day = data[\'before\'][i];
var dte = new Date(day);
I am trying to display the dates as a link in a div dynamically from java script. On clicking the link I am passing dte as object to date_click function.
$(\'#before_dates\').append(\'<tr><td><a onclick=\"date_click(\'+dte+\');\" href=\"javascript:void(0)\">\'+dte.toDateString()+\'</a></td></tr>\');
On clicking the link the
function date_click(date){
alert(\"Hi...\"+dte);
}
I am getting following error:
Error: SyntaxError: missing ) after argument list
Source Code: date_click(Fri Aug 31 2012 00:00:00 GMT+0100 (IST));
I know its small error, but I could not figure a way to do that. Any help would be great.
Thank You





Rating:
The post passing arguments from one function to another in javascript appeared first on Javascript ASK.
via Javascript ASK http://javascriptask.phpfogapp.com/passing-arguments-from-one-function-to-another-in-javascript.html
No comments:
Post a Comment