SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: if to check if field filled
-
Nov 12, 2003, 09:30 #1
- Join Date
- Nov 2003
- Location
- UK
- Posts
- 821
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
if to check if field filled
Hi i have an if structure checking to see of the fields have been filled in.
On the text fields though there is no value so how can i check to see if nothing there which would mean aint been filled in.
i tried
if(variable = ""){
bla bla bla ..............
}
doesnt work, please advise
-
Nov 12, 2003, 10:10 #2
- Join Date
- Dec 2002
- Location
- Alabama, USA
- Posts
- 2,560
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
'=' is the assignment operator. You need to use the equality comparison operator:
Code:if (myTextField.value == "") { } else { }
Code:if (myTextField.value.length < 5) { alert('invalid'); } else { }
Cross-Browser.com, Home of the X Library
-
Nov 12, 2003, 10:15 #3
- Join Date
- Nov 2003
- Location
- UK
- Posts
- 821
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
yeh i knew the ==
> mess up in last post!
as for the second way, that may just do the trick! becuase just saying "" donest do any thing!
Bookmarks