edit element function