Changing the .attr to .prop (jquery compatibility