update function getParent to get parent of specified element