Here's my fiddle https://jsfiddle.net/8u4rgz8v/
Expected result: when I click on the site name it alerts its number e.g. Site1 alerts 1
I encapsulated the call to the onClickSite function with a function as you can see but it doesn't work.
I also tried encapsulating the body of the onClickSite function in a return function(){}
but it didn't even alert.