Hello, I need help please,.. all i wanted is to have this output <span onclick="myfunction('1','2','3')">Link</span> my script is: <span class="clickable" onclick=\"myfunction("'+data.tid+'","'+data.startpay+'","'+data.endpay+'")\">' + data.emp + '</span> This doesn't seem to work right as when i look into my console the output is: <span class="clickable" onclick="myfunction(" 34","","")"="">Link</span> all i wanted is to output this like <span onclick="myfunction('1','2','3')">Link</span> Thank you
@sarahk: javascript, since (s)he is using '+' to concatenate strings, not '.' @neilfurry: why don't use a bit of modern way to inject <span> ? untested, but it looks something like below: var span = target_element.appendChild(document.createElement('span')); span.appendChild(document.createTextNode(data.emp)); span.className = 'clickable'; span.addEventListener('click', function(){ myfunction(data.tid, data.startpay, data.endpay); }, false); Code (JavaScript): it's lenghtier, but tidier