The problem statement is simple. I need to see if user has selected a radio button from a radio group. Every radio button in the group share same id.
The problem is
$("input[name='gender']:checked").val()
for nested attributes
$("input[name='lead[gender]']:checked").val()
Don't forget single braces for name