This code is returning an empty array when I run it even though there is a div with the attribute [data-directory] in the container.
$(container).children( '[data-directory]' )
please check to see whether
container is a valid and exists if it does. then
$(container).find( '[data-directory]' ) would do
.children would only look in the immediate
children. where as
.find will go through all the descendants which i think is what you want