Updated for both textarea and input