jquery - function that checks if a radio button is check/not-checked in javascript -


this question has answer here:

hey i'm stumped on rewriting function jquery javascript. function have written works great issue is, has written in plain javascript. here function have written:

function checkfunc() {     if ($('input[type="radio"]:checked').length === 0) alert("not checked");     else alert("checked"); } 

i need function work same way need in javascript! appreciated. thanks!

simply document.queryselectorall

function checkfunc() {    if (document.queryselectorall('input[type="radio"]:checked').length === 0) alert("not checked");    else alert("checked");  }    checkfunc()
<input type="radio" checked>  <input type="radio">


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -