Created clearElement fun in main.js for general purpose