Understanding The Failed To Execute Insertbefore Error In Javascript