I am trying to replace the value of the input with nothing when someone clicks on it,
I tried the below, but i keep getting this error in the console, can you help me out
elem.addEventListener is not a function
HTML
<input type='text' name='first-name' value='first name' class='fieldedit' /> 
JS
<script type="text/javascript"> 
    var elem = document.getElementsByClassName('fieldedit');
    function fieldedit() {
        if (this.value == this.defaultValue) {
            this.value = '';
        }
    };
    if(elem){
        elem.addEventListener('focus' , fieldedit , false ) ; 
        elem.addEventListener('blur' , fieldedit , false ) ; 
    }
</script>
 
     
     
    