From  .attr(selected,true) to .prop(selected,true) to follow Jquery guid...

...elines

http://api.jquery.com/prop/