I have a project to do and it is pixel art maker from udacity.
The problem is when I press on submit, it refreshes the whole page, but I want it to stop refreshing and do his job.
What should i do?
This is my JavaScript code (Note: I haven't finished yet):
document.getElementById("sizePicker").onsubmit=function(e){
sizePicker.addEventListener("submit",function(e){
var rows=document.getElementById("inputHeight").value;
var cols=document.getElementById("inputWidth").value;
makeGrid(rows,cols);
});
}
function makeGrid(e){
let table=document.getElementById("pixelCanvas");
for (let k=0; k<=rows; k++){
grid+="<tr>";
for (let u=0; u<=cols; u++){
grid+="<td></td>";
}
grid+="</tr>";
}
}