Javascript onsubmit clearcontent not working.
        Posted  
        
            by Azzyh
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Azzyh
        
        
        
        Published on 2010-06-13T21:44:10Z
        Indexed on 
            2010/06/13
            21:52 UTC
        
        
        Read the original article
        Hit count: 200
        
JavaScript
<textarea onfocus=" javascript:clearContents(this); this.cleared=true;" rows="5" cols="40" id="comment" name="comment" <?php if($vis["username"] == $pusername) { echo "DISABLED"; } ?>>...</textarea>
<input onsubmit="if (!this.comment.cleared) clearContents(this.comment); return true;" type="submit" name="Submit" value="Stem!"/> 
function clearContents(element) {
  element.innerHTML = '';
}
This wont work, and i cant figure out why. What it does: clears the content if it hasnt been onfocus/clicked on by the person
© Stack Overflow or respective owner