skrippyfingaz
skrippyfingaz

Reputation: 323

How Can I Rewrite This Line Without The Use of jQuery?

Got a quiz app here, I'm wondering how I can rewrite this conditional without the $.

if ($('input[name="radioOption"]:checked').length < 1) {
    alert('Please Make a Selection');
}

Here is a fiddle to all the code:: https://jsfiddle.net/scrippyfingers/z84pc45t/

Upvotes: 0

Views: 68

Answers (1)

Stefan Vilbrandt
Stefan Vilbrandt

Reputation: 292

if(!document.querySelector("input[name='radioOption']:checked")) {

That should work for you.

Upvotes: 5

Related Questions