Jump to content

Search the Community

Showing results for tags 'createtextnode'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I'm using JavaScript to validate a form field. Basically, if the form is submitted and the default value of the field is not altered, a text node with an error message will be generated. Problem is if the submit button is clicked over and over, the error message will appear just as many times as the button is clicked, ie. Incorrect information.Incorrect information.Incorrect information.Incorrect information. How do I make the generated message appear only on the first button submit. I tried this but it JavaScript: window.onload = function(){ 'use strict'; var errorMsg = 'Incorrect information.'; document.getElementById('btn').onclick = function(){ if(document.getElementById('btn').value == document.getElementById('btn').defaultValue){ var msg = document.createTextNode(msg); document.getElementById('btn').parentNode.appendChild(msg); /* This if statement didn't work if(msg){ document.getElementById('btn').parentNode.replaceChild(msg); }*/ } }; }; html: <body> <form action="#" method="POST" id="theForm"> <div><input type="text" name="firstName" id="firstName" value="First Name"/></div> <input type="button" name="btn" id="btn" value="Submit Info"/> </form> <script src="js/validate.js"></script> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.