I have a dynamic Html table in which there is a cell that contains anchor tag. Along with the anchor tag, I'm calling a function thru OnClick method. That function takes two parameter and both are String type.
In that, one string contains the value like this "PUT Request|GET Request|JDBC Request|"
Example:
<td align='center'><a href='#' title='click here' onclick=showTestCaseReport('"
+ tcId + "','" + strStep + "')>Detail</a></td>
JavaScript function:
function showTestCaseReport(testCaseId, testSteps)
{
alert(testCaseId);
alert(testSteps);
}
But when click on the click i.e. Detail from the browser, Javascript alert is not displaying as per the function defined.
EDITED: After analysed, I came to know that the String value that I had mentioned above has white space in the middle. After removing the white spaces like this PUTRequest|GETRequest|JDBCRequest|, its working.
Ques: Is there any way to handle this without removing the white space in the middle of the string values?
Thanks
Your onclick attribute is missing quotes please add them correctly and proceed See this https://jsbin.com/viqosobizo/edit?html,output
<td align='center'><a href='#' title='click here' onclick="showTestCaseReport('hello','great');">Detail</a></td>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments