Home  >  Article  >  Web Front-end  >  Use js's for loop to get the selected radio value_javascript skills

Use js's for loop to get the selected radio value_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:19:251132browse

For example:

Copy code The code is as follows:





  • where the name attribute The values ​​must be the same. Next, use js to get the selected value:
    Copy the code The code is as follows:

    var zt = document.getElementsByName("zt");

    for(var i=0;iif(zt[i].checked) {
    alert(zt[i].value);
    }
    }

    Use a for loop to get it done.
    Statement:
    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