How to can show alert after empty text field is submitted?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nauman Muti

    How to can show alert after empty text field is submitted?

    How we can show alert (Please enter your name) after the clear text field.
    Last edited by MMcCarthy; Nov 3 '10, 11:33 AM.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Post your code.

    Access the element using document.getEle mentById() and then check if it's empty:
    Code:
    if (textbox.value == "")
    You may also want to trim the value of spaces before checking.

    Comment

    Working...