Error in JavaScript Alert On Checkbox
<p>I have a problem in my JavaScript code. </p>

<p>I have a HTML form in which I use table values that are fetched from Mysql table. I use an array to print my all values in my table. 
Here is output of my form:</p>

<p><a href="https://i.stack.imgur.com/sNj7o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sNj7o.png" alt="enter image description here"></a></p>

<p>After that I use JavaScript to alert: "<em>Please select at least one opinion (Mutual Fund).</em>"</p>

<p>Here is my code</p>

<pre><code>    function checkRatings(){
    var checked = [].reduce.call(document.forms[0].opinion, function(current, item) {
    if (item.checked) {
      current.push(item.value);
    }
    return current;
  }, []);
  if (checked=='')
    {
        alert("Please select at least one opinion");
        return;
    }
 else 
    document.getElementById("form_id").submit();}
</code></pre>

<p>This code working fine when I have multiple opinions (Mutual Fund) just like as above figure, but it's not working when I have only single opinion. As on this image:<br>
<a href="https://i.stack.imgur.com/NwwlH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NwwlH.png" alt="enter image description here"></a></p>

<p>In this scenario after I check opinion it gives me the alert again and again and could not proceed it...</p>

<p>Can anyone please help me?</p>