About changing radio buttons in HTML

Multiple radio buttons with the same name act as a set, where checking cancels others. What is the scope of this behavior?

  • The form in which the button is located
  • The page / document the button is on
  • Does region iframe in iframe s?

I always used them in forms, but now I wrote formless HTML (using ajax for publishing) and everything seems to work very well, so I guess this is No. 2.

+4
source share
2 answers

Radio buttons with the same name in the same form act as a set, but not with different forms. Formless radio buttons act as a set with those who do not have forms.

check it out yourself: http://jsfiddle.net/8qqNC/1/

+8
source

Radio buttons are tied to the form in which they are located.

Frames contain external documents, and nothing in them is considered part of the current document, not to mention the element inside this document.

+2
source

Source: https://habr.com/ru/post/1347359/


All Articles