Used checked function instead of using if condition for displaying checked attribute

Used checked function instead of using if condition for displaying checked attribute.