Home > Web Front-end > HTML Tutorial > When the name of the radio button button is a number, the status of the button cannot be obtained. The code _html/css_WEB-ITnose is attached.

When the name of the radio button button is a number, the status of the button cannot be obtained. The code _html/css_WEB-ITnose is attached.

WBOY
Release: 2016-06-24 12:19:29
Original
1273 people have browsed it

alert(document.form1.1.checked);


The above sentence is wrong , cannot get whether the button is selected

Only when the name is not an array, is there any solution, because the buttons are dynamically generated, and the names are all numbers


Reply Discussion (Solution)


name =s1 The combination of letters and numbers will not work==

It is not possible to set it to 1, but s1 is OK. Did you get it after loading?

Why do you have to use name? Give it an ID



js======

alert(document.getElementById('abc').checked);

alert(document.getElementsByName('1')[0 ].checked)

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template