Conditional logic not working when using img tag with radio buttons