EDITABLE CODE:
LiveDemo:jQuery - Setting Attributes using attr() Method
Note:The method attr() returns a jQuery object, meaning you can perform a method chaining