This is my function and it should change the onClick attribute of the HTML input, but if I use
document.getElementById(\'buttonLED\'+id).onclick = \"writeLED
Using Jquery instead of Javascript, use 'attr' property instead of 'setAttribute'
'attr'
'setAttribute'
like
$('buttonLED'+id).attr('onclick','writeLED(1,1)')