added support for providing the dom element in stead of just the id

added support for providing the dom element in stead of just the id