jQuery 1.6+ Change attr to prop

by GarciaPL on Saturday 7 December 2013

In the last days I was working on project which used one of the most powerful Javascript library jQuery in version 1.4.4. Yes, I know this version of jQuery is quite outdated. So, we decided to change it into jQuery 1.6.1. We expected some problems with change of library version, but what we discovered during looking for application errors was the change of handling of attributes and DOM object properties. I mean change function .attr to .prop

Before when we used jQuery 1.4.4 it was :


        jQuery 1.4 attr
        
        
    
    
        
        
    

Starting from jQuery 1.6+ it is :

        jQuery 1.6 prop
        
        
    
    
        
        
    



Reference : [1] Bugs.jquery.com Ticket 9088 [2] Ejohn.org - jQuery 1.6 and attr