Replacing attr with prop for compliance with jquery 1.7 and above