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

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -