0

My code:

document.querySelector('input[name=fos_user_registration_form[gender]]:checked')

it doesn't work because of [gender].

Do you have an idea to select this type of input ?

1 Answers1

0

Quote the attribute to allow special characters inside.

document.querySelector('input[name="fos_user_registration_form[gender]"]:checked')
Barmar
  • 741,623
  • 53
  • 500
  • 612