Edit: a, b, c are objects.
I have an erb file as follows with a, b, c variables.
<script type="text/javascript">
function fun(a,b,c){
console.log(a);
console.log(b);
console.log(c);
}
</script
<% a %>
<% b %>
<% c %>
<input type="checkbox" id="group_box" onclick="fun(a,b,c);"/>
But either the variable gets passed as string or it throws Invalid or Unexpected token error.
What am I doing wrong?
This is all I have tried so far -
onclick = "fun(a, b, c)"
onclick = "fun('a, b, c')"
onclick = "fun(\'' + a + '\', \'' + b + '\', \'' + c + '\')"
onclick = "fun(\'' + <%= a %> + '\', \'' + <%= b %> + '\', \'' + <%= c %> + '\')"
TIA