Add dom selection functions and a function to get an element from optional element