JSFiddle - React, Tailwind, and code Playground

by Michel Plungjan

HTML

<table><tr>
    <td id="c1s2a"><input type="text" name="allow_move" value="1"></td>
    </tr>
    </table>

JavaScript

window.onload=function() {
    // gives error
   // document.getElementById("c1s2a").getElementsByName("allow_move")[0].value=0
    // this one is much better but may have issues in IE<9
    window.console && console.log(document.getElementById("c1s2a").children["allow_move"])
    // as does this
    window.console && console.log(document.querySelector("#c1s2a input[name='allow_move']"));
  // brute force
  var inputs = document.getElementsByName("allow_move");
    for (var i=0, n=inputs.length;i<n;i++) {
        window.console && console.log(inputs[i].parentNode.id)
        if (inputs[i].parentNode.id=="c1s2a") {
            inputs[i].value=0;
        }    
    }
}