The values for the text fields "inputw1" and "inputw2" are added. After clicking on the button, a list of the form should be generated: "a-->b cd-->w ..." Uncaught TypeError: Cannot read property 'appendChild' of null
function pushRules(list){
var rules = "";
var w1 = document.getElementById('inputw1').value;
var w2 = document.getElementById('inputw2').value;
var w = w1+'-->'+w2;
for(var i=0; i<w.length; i++){
rules+=w[i].value;
}
var li = document.createElement("li");
var rule = document.createTextNode(rules);
li.appendChild(rule);
document.getElementById("list").appendChild(li);
}
<form>
<label>w1:</label><input id="inputw1" type="text"><label> --> w2:</label><input id="inputw2" type="text">
<input type="button" value="add rule" onclick="pushRules()">
</form>