Remove the $w wrapping selectedMem and newMem. $w is used to select elements, you don’t need it here.