Document. Log(): "Undefined Is Not a Function"
I Know, I Know, Is a Common Error and You Should Look at Others and Blah Blah Blah. I Have and I Could Not Have Found a Solution. This Is My Entire Code...
I know, I know, is a common error and you should look at others and blah blah blah. I have and I could not have found a solution.
This is my ENTIRE code.
<div id="div"></div>
<script>
function item(id, price, name, icon){
this.id = id;
this.initPrice = 0;
this.price = price;
this.name = name;
this.icon = icon;
document.getElementById("div").innerHTML += this.name + " = $" + price + " <input id=\"itemNum" + this.id + "\" onchange=\"item" + this.id + ".calc()\" type=\"number\" style=\"width: 40px;\" value=\"1\"></input><br>";
this.calc = function(){
document.log("yay");
}
}
var item1 = new item(1, 700, "Barrel #1", "");
item1.calc();
</script>
I get the error at line 14 and when I change the input I get the same error at line 14 again. What am I doing wrong? How can I fix this?
2 Answers
Try console.log() and not document.log()