I have a 9x9 sudoku grid, and each box has an input element assigned to it.
When I set the values in the box and try to inspect the input element I notice that the innerHTML
property is empty (""
).
This is where I am stuck, why is input element not picking the values that I enter?
Here's my JS:
window.onload = function(){
var grid = [];
setInputBox();
document.getElementById('btn').onclick = function(){
solve(grid);
}
};
function setInputBox(){
var inputElements = document.getElementsByTagName('td');
for(var prop in inputElements){
if(inputElements[prop].innerHTML = " "){
inputElements[prop].innerHTML += '<input type="number" min="1" max="9"/>';
}
}
}
var solve = function(grid){
grid = document.getElementsByTagName('input');
console.log(grid);
// for(var i = 0; i < 9; i++){
// for(var j = 0; i < 9; j++){
//
// if(checkValidity(grid,i,j)){
// console.log('valid');
// }
// else{
// console.log('invalid');
// }
// }
// }
}