use .text only after checking is an element