First, you need the same ID in both locations. You have 401 for the scrollbar, but then check 400 in the dialog event. Second, use .sel to get the scroll location... $did(401).sel