In the below code,
<form action="javascript:void(0)" method="GET" enctype="multipart/form-data">
            <fieldset>
                <legend>Details</legend>
                Enter the name: <input id="name" name="name" type="text" size="30"
                                onblur="isTheValueValid(this, document.getElementById('name_help'));">  
                <span id="name_help"></span>
                <br>
            </fieldset> 
        </form>
<script type="text/javascript">
            function deleteAllChildren(spanElementObject){
                if(spanElementObject != null){
                        var nodeList = spanElementObject.childNodes;
                        [].forEach.call(nodeList,function(property){
                            delete property;
                        }); 
                }
            }
            function editSpanElementText(regex, inputElementValue, spanElementObject, helpMessage){
                deleteAllChildren(spanElementObject);
                if(!regex.test(inputElementValue)){
                    spanElementObject.appendChild(document.createTextNode(helpMessage));
                    return false;
                }else{
                    return true;    
                }
            }
            function isTheValueValid(inputElementObject, spanElementObject){
                return editSpanElementText(
                                    /^[\u0041-\u005A\u0061-\u007A\.\' \-]{2,15}\s?[\u0041-\u005A\u0061-\u007A\.\' \-]{0,15}\s?[\u0041-\u005A\u0061-\u007A\.\' \-]{2,15}$/, 
                                    inputElementObject.value, 
                                    spanElementObject, 
                                    'Please enter a valid name.');      
            }
        </script>
For the first try, on losing focus on input element, error message, Please enter a valid name. gets rendered on giving wrong input value.
For the second try, on losing focus on input element, error message Please enter a valid name. does not get removed on giving correct input value.
On debugging forEach does not delete the #text childnode.
Why delete does not delete the properties?
 
     
    