update #2 .text() to detect input elements and use value instead of innerHTML