javascript - how can i automatically calculate an expression from a text field -


how can automatically calculate expression text field .. there function or thing ..

 <input type="text" value="3+4" id="txt">      var result = function_in_javascript(document.getelementbyid("txt").value)      alert(result )// 7 

try eval(document.getelementbyid("txt").value)

edit: though?


Comments

Popular posts from this blog

All overlapping substrings matching a java regex -

c++ - Using OpenSSL in a multi-threaded application -

php - Deleting/Renaming a locked file -