You need to pass this
as part of the string
$("#varTable > tbody:last").append("<tr style='border: 1px dotted black;' onclick=\"rowClick('" + newVariable.Name + "',this)\">><td><img id='Img12' src='images/Delete.png' width='35' height='35' style='margin-left:0px; margin-top: 10px;'></td><td>New Variable</td><td>Global</td><td></td><td><center>0</center></td><td><form action=''>" +
"<center><input type='checkbox' name='RetainValue' value='Retain'></center></form></td><td width='100px'><button type='button' onclick='editVariable()'>Edit</button></td></tr>");
You need to evaluate this
at the time of the event. Currently, you're evaluating it at the time of the append.