| | |
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 animate array automatically beta box browser bug calendar captchaformproblem cart checkbox close codes column createrange() css cursor date debugger decimal dependent design dom download dropdown element embed enter error events firefox focus form frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 iframe images index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsfile jsp libcurl listbox maps masterpage media menu microsoft mimic mp4 onmouseover paypal php player position post problem programming progressbar prototype redirect regex runtime safari scale scriptlets search security select size software sql text textarea unicode w3c website window windowofwords windowsxp





