I want to get the length of a radio button using the jquery syntax
Problem is, in 2nd method, you are missing quotes. Use this:
If name contains special characters including  it has to be quoted, like you did in first case. You are just appending content of name variable into string, which is sent into jQuery like in the first case.