Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Below is my code while sending two parameters through onclick event i am getting a error as "Uncaught SyntaxError: Invalid or unexpected token"

  html += "<td class='" + className + "'><a href='#' data-toggle='modal' data-target='#tourRequModal' onclick='dateSel(" + Date + "|" + priceArr[i] + ")'>" + i + priceText + "</a></td>";
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
519 views
Welcome To Ask or Share your Answers For Others

1 Answer

Here using Date alone causes the problem so Write it as:

html += "<td class='" + className + "'><a href='#' data-toggle='modal' data-target='#tourRequModal' onclick='dateSel("" + new Date().toString() + ""," + priceArr[i] + ")'>" + i + priceText + "</a></td>";

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...