i have a problem with my javascript and html
i was trying to write a html element using a function from my javascript here's my code
function write();
{
for(var i=0;i<arr.length;i++)
{
document.write("<td>"+arr[i]+"</td><br>")
}
}
and code at my index.html, i want put that write inside my table row
<tr>
<script>write();</script>
</tr>
i have attached my javscript to my html document, but nothing happened can u guys help me to put make that function work?? thanks guys!!
</tr>instead of<tr>document.getElementById("myElement")obviously replacing myElement for the id of your actual HTML element. You can add content in various ways but try researching.appendChild()and.innerHTMLthis should help.