use jQuery prop() instead of attr()