I need to pass string as ID in onclick function. When I pass integer as id, it's working fine but when I pass string, it's not even going to the function.
HTML Code ( below is table row. This is inside a for loop)
<td class="col-md-2" width="50" style="background-color: transparent;">
<input class="btn btn-sm btn-primary fa" id='[email protected]' type="button" value="" onclick='showedit(@item.ID);' />
</td>
Javascript Code:
function showedit(par) {
if (editItem == par) {
return;
}
if (editItem > 0) {
cancel(editItem);
}
--code processing--
editItem = par;
}
The above code works fine if there is integer value in item.Id. But when I change the HTML code to have string value in item.Id, nothing happens. It isn't even going to the function (checked by putting breakpoint).
HTML Code- with item.ID as string ***the below isn't working***
<td class="col-md-2" width="50" style="background-color: transparent;">
<input class="btn btn-sm btn-primary fa" id='iedit-\"" [email protected] +"\"' type="button" value="" onclick='showedit(\"" [email protected]+ "\");' />
</td>
I searched and tried couple of similar options but nothing seem to be working for me. Please advise.