[RESOLVED] Uncaught SyntaxError: Unexpected token ILLEGAL
Good Day All
in my page i have a hyperlink button in a gridview defined like this
Code:
<a href="#" onclick="<%# String.Format("return showComment('{0}','{1}')", Replace(Eval("Field1").ToString(),Chr(13),"<BR>"), Replace(Eval("Field2").ToString(),Chr(13),"<BR>") ) %>">
<img src="../../Imgs/comment2.png" />
</a>
and the Function showComment is defined like this
Code:
function showComment(CommentPend,CommentCancel)
{
$("#btnclose").unbind();
$("#divPendComment").center();
$("#divPendComment").fadeIn('slow');
$("#txtcomment").val(CommentPend.toString().replace(/^[a-z0-9 ]$/i, ''));
$("#txtcommentCancel").val(CommentCancel.toString().replace(/^[a-z0-9 ]$/i, ''));
$("#btnclose").click(function (e)
{
$("#divPendComment").fadeOut('slow');
e.preventDefault();
});
return false;
}
now as you can see i am trying to get rid of the special characters like the carriage returns but still i get a a javascript error when this link is clicked
Uncaught SyntaxError: Unexpected token ILLEGAL
thanks
Re: Uncaught SyntaxError: Unexpected token ILLEGAL
I could be totally off base here... but doesn't the regex expression need to be passed as a string?
replace(/^[a-z0-9 ]$/i, ''));
should be
replace('/^[a-z0-9 ]$/i', ''));
-tg
Re: Uncaught SyntaxError: Unexpected token ILLEGAL
It took longer than expected. so because of time as the data was coming from the DB , i had to clean it from there.
This issue has been resolved.
Thanks