Basically, I wrote this function in JavaScript:
<script>
function getVal(value) {
console.log(value);
}
</script>
And this is my HTML input tag:
<input onchange="getVal(this.value)" type="text" id="unit" />
I am expecting to get value of this element printed in console (which I don't). I am not manually typing in value of element but rather setting it with this piece of code:
<script>
var table = document.getElementById('table');
for(var i = 1; i < table.rows.length; i++) {
table.rows[i].onclick = function()
{
//rIndex = this.rowIndex;
document.getElementById("unit").value = this.cells[0].innerHTML;
};
}
</script>