| | |
Trim spaces
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2007
Posts: 34
Reputation:
Solved Threads: 0
I want to make sure at least 3 characters are entered into a search field.
For example I dont want this to go by where it has spaces in beginning and space between 2 characters: Is there a regular expression or someway to trim the spaces between the characters so I dont let less than 2 characters get submitted?
Here is one reg expression I tried but it let spaces between characters get entered so less than 3 characters were submitted.
/^\s+|\s+$/g,""
For example I dont want this to go by where it has spaces in beginning and space between 2 characters:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
a b
Here is one reg expression I tried but it let spaces between characters get entered so less than 3 characters were submitted.
/^\s+|\s+$/g,""
![]() |
Similar Threads
- C/C++ Code Syntax Highlighting (DaniWeb Community Feedback)
- Please help with assignment (C++)
- Using isspace with white spaces (C++)
- Trim Strings (JavaScript / DHTML / AJAX)
- trim trailing spaces (C++)
- Whats wrong with this class??? (C++)
- This ought to be simple - extra spaces (PHP)
- I don't know how to start (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Onclick to pass a variable to a PHP script
- Next Thread: help please ie based javascript problem
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets automatically beta box browser bug captchaformproblem checkbox close codes createrange() css cursor debugger decimal dependent disablefirebug dom download dropdown editor element engine enter error events explorer ext file firefox form forms frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe index internet java javascript javascripthelp2020 jquery jsf jsfile jsp jump listbox maps masterpage math media menu microsoft mp4 object onmouseoutdivproblem onreadystatechange paypal pdf php player position programming progressbar prototype redirect regex runtime safari scale scriptlets search security select size software sql text textarea unicode w3c window windowofwords windowsxp wysiwyg \n





