+ 5
Why onscroll doesn't works on child element?[ SOLVED]
4 Respuestas
+ 4
Because your #child doesn't have a content exceeding its border and an overflow property like your #parent has
Try adding a second inner child with height 600px and an overflow-y on #child.
+ 2
If you want to shortcut getElementById by treating the id as window property, you need to avoid name collision with already existing window properties.
Try renaming to parent1 and you can shortcut.
+ 1
Gordon ty I thought onscroll works on elements that is scrollable ,so i attached it on the child element ,i tried it with parent but it didn't work before because I was trying to attach the onscroll on global id (parent ) instead of selecting it first ,
0
Gordon thks again