Ensures tElm and elm are jQuery objects before calling jQuery functions on them

Some assumptions were made about tElm, specifically that it should have
functions is() and select2(). Those assumptions only hold true for
jQuery objects. So if tElm or elm are not jQuery objects, this commit
ensures that they are wrapped in $(/*element*/).