This kinda funny, i want to quote a string value for a function but javascript throws this error Uncaught SyntaxError: Unexpected token }
This my code
var val = "Testing String";
var table_row = "<tr><td><a href='#' onclick='test('"+val+"')'>Row1</a></td></tr>";
function test( val ){
alert( val );
}
The table row get created fine with the test function bound well with onClick event. But when i click on the created link i get
`Uncaught SyntaxError: Unexpected token }
The Value within the test function should be a quoted string.
Note: If i remove the concatenation of the val string, and pass is as a string like this
table_row = "<tr><td><a href='#' onClick='test(\"Testing String\")' >Row1</a></td>";
... it works
Where am i goofing?
Gath.
"..."Row1"..."really work?