I have a realy hard problem that I couldn't find any solution in Internet
I used document.getElementsByClassName
to access one HTML Element
by It's class, my element is filterRow
of dxDataGrid
:
var filterRowElement = document.getElementsByClassName("dx-datagrid-filter-row");
console.log(filterRowElement);
console.log(filterRowElement.length);
My Problem is: The first console.log
return HTMLCollection
with length = 1 but the second return 0 (I tried to get length to access filterRowElement[0]
).
I've tried console.log(filterRowElement[0])
and got undefined
too
I don't know why, it is the first time I got this problem
Please give me some advise. Thank you!
THANK YOU, I THINK MY PROBLEM IS DXGRID FILTERROW ELEMENT
IS CONSECUTIVELY CHANGE SO I CAN'T ACCESS OLD ELEMENT
UPDATE
I don't know why but Using Jquery save Me (may be not alway true)
setTimeout(function () {
var getfilterRowElement = $(".dx-datagrid-filter-row");
console.log(getfilterRowElement[0]);
}, 3000);
Result:
Thank you so much