Using JavaScript solution without jQuery