Vote count: 0
I am using simple length function to check length greater than zero based on id. Code i am using is
if ($('#abcd').length > 0)
{
var abcd = $('#abcd').val();
}
This code is working fine and producing no error. But if i am using simple javascript in this way
if (document.getElementById('abcd').length > 0)
{
var abcd = document.getElementById('abcd').val();
}
Then it is not working and producing this error "Uncaught TypeError: Cannot read property 'length' of null". What does this error mean and how can i get this working ?
asked 10 secs ago
"Uncaught TypeError: Cannot read property 'length' of null JAVASCRIPT
Aucun commentaire:
Enregistrer un commentaire