dynamically generating js driving me crazy

dynamically generating js driving me crazy

I am dynamically generating html and js with this string:

  1.                             htmlStr+="<div class='list-group-item Specification' " +
  2.                                            "onClick=displayResults(" + key + ", '" + time + 
  3.                                                                         "', '" + foodGroups + "')>";
In Chrome debugger it generates the html I want, where onclick=displayResults(1, '14:03', 'meat, veggies, fats')>
but in the final html that is generated the quotes are messed up and I don't understand why.