I'm creating anchor tag dynamically like
for (var i = 0; i < json.length; i++)
{
<td><a href='#' id=" + json[i].id + " onclick=getId('" + json[i].id + "','"+ json[i].text +"')>" + json[i].text + " </a></td>
}
and In the onclick
function I have defined like
function getId(ID,text)
{
console.log(ID);
console.log(text);
}
In this onclick
event If the text value doesn't contain any space or gap between word to word, I'm able to get the text value in console,
In-case If text contains any spaces then It is showing error like Unexpected token ILLEGAL
.