1

Possible Duplicate:
What is the best way to trim() in javascript

How to trim document.getElementbyId value in JavaScript?

Community
  • 1
  • 1
Abdul Rahman
  • 682
  • 2
  • 6
  • 20
  • this URL might help http://www.opensourcevarsity.com/javascriptbasics/l5trimmingwhitespaces – CyprUS Aug 25 '11 at 10:27
  • Without jQuery: http://stackoverflow.com/questions/498970/how-to-trim-a-string-in-javascript – Shadow The GPT Wizard Aug 25 '11 at 10:32
  • In your case, just take the code from [this answer](http://stackoverflow.com/questions/498970/how-to-trim-a-string-in-javascript/498995#498995) and have something like: `var value = document.getElementById("myInput").value; var trimmed = value.trim();` – Shadow The GPT Wizard Aug 25 '11 at 10:33
  • 1
    Maybe you did not express it correctly, but trimming the value returned by `getElementbyId` does not make sense. It returns a DOM element. – Felix Kling Aug 25 '11 at 10:41

0 Answers0