I created a function in javascript, but it returns the following error:
Can not read property 'value' of null
Here's a piece of code:
function Distribuir(control) {
var tr = $(control).parents('tr');
var quantidade = $(tr).find("input[id*='txtQuantidade']").val();
var distribuir = document.getElementById("txtDistribuir").value;
if (document.getElementById("<%= txtDistribuir.ClientID %>") != null) {
var distribuir = document.getElementById("txtDistribuir").value;
resultado = distribuir - quantidade;
$(tr).find("input[id*='txtDisponivel']").text(resultado);
}
}
I am already doing the treatment to see if it is null, but it still returns the error. in the var distribuir = document.getElementById("txtDistribuir").value
part is always coming undefined, I can not get the value that is in that textbox.