Technically element has the chance of being undefined here. I would wrap this in a safe check of sorts to know whether or not it's actually there.