I am building a list automatically from a JSON with the following code
dataObject.forEach(newList);
function newList(item, index) {
  var s = item.time;
  alert(s);
  var list = $('<li onclick="myFunction(s)">' + listItemString + '</li>');
....
}
The alert(s) print the right values of s but when I click on the element I get an error ReferenceError: s is not defined
