title: what is the condition to check value from input text with javascript
body: <p>I make a quiz app with codeigniter. When i publishing question i need to check the option value with answer value. so how i make this check with a suitable condition.or what is the condition for checking all this option value with answer value? 
  Below i show my <strong>view</strong></p>
  
  <pre><code>&lt;?php include_once('header.php'); ?&gt;
  &lt;?php include_once('tnavbar.php'); ?&gt;
  
  &lt;script src="&lt;?php echo base_url();?&gt;/js/jquery-1.9.1.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
    function validateForm1(){
  var j=3;
  //alert(j);
  for(var i=1; i&lt;= j ; i++){
  var qus1=document.forms["myForm1"]["ques[" + i + "]"].value;
  var opt1=document.forms["myForm1"]["opt1[" + i + "]"].value;
  var opt2=document.forms["myForm1"]["opt2[" + i + "]"].value;
  var opt3=document.forms["myForm1"]["opt3[" + i + "]"].value;
  var ans1=document.forms["myForm1"]["ans[" + i + "]"].value;
  
  if ((qus1==null || qus1=="")||(opt1==null || opt1=="")||(opt2==null || opt2=="")||(opt3==null || opt3=="")||(ans1==null || ans1==""))
  {
    alert("All field must be fill");
  return false;
    }
  
  }
  for(var z=1; z&lt;= j ; z++){
  //var qus2=document.forms["myForm1"]["ques[" + z + "]"].value;
  var opt4=document.forms["myForm1"]["opt1[" + z + "]"].value;
  var opt5=document.forms["myForm1"]["opt2[" + z + "]"].value;
  var opt6=document.forms["myForm1"]["opt3[" + z + "]"].value;
  var ans2=document.forms["myForm1"]["ans[" + z + "]"].value;
  
  if ((opt4||opt5||opt6)==ans2)
    {
    //alert("answer not match");
  return true;
    }
    else{
    alert("answer not match");
    return false;
    }
  
  //return true;
  }
  }
  &lt;/script&gt;
  
  &lt;div class="maincontent_area"&gt;
  &lt;div class="container"&gt;
      &lt;div class="row"&gt;
          &lt;div class="span12"&gt;
          &lt;form id="myForm1" action="&lt;? echo base_url()."/index.php/Tmcq_test/insertmcq";?&gt;" onsubmit="return validateForm1();" method="post"&gt;
              &lt;?php         for($i=1; $i&lt;= 3; $i++){
  ?&gt;
     Question : &lt;input type="text" name="ques[&lt;?php echo $i;?&gt;]"&gt;&lt;br/&gt;
     Option 1 : &lt;input type="text" name="opt1[&lt;?php echo $i;?&gt;]" &gt;&lt;br/&gt;
     Option 2 : &lt;input type="text" name="opt2[&lt;?php echo $i;?&gt;]" &gt;&lt;br/&gt;
     Option 3 : &lt;input type="text" name="opt3[&lt;?php echo $i;?&gt;]" &gt;&lt;br/&gt;
     &amp;nbsp;Answer : &amp;nbsp;&lt;input type="text" name="ans[&lt;?php echo $i;?&gt;]" &gt;&lt;br/&gt;
  
     &lt;br/&gt;
     &lt;?php  //echo $value-&gt;answer;
  
      } ?&gt;
  
                      &lt;input type="hidden" name="quiz_name"  value="&lt;?php echo $name;?&gt;"&gt;
                      &lt;input type="hidden" name="sub_id"  value="&lt;?php echo $sub_id;?&gt;"&gt;
                      &lt;input type="hidden" name="quiz_number"  value="&lt;?php echo $number;?&gt;"&gt;
                      &lt;input type="hidden" name="time_number"  value="&lt;?php echo $time_number;?&gt;"&gt;
  
          &lt;input type="submit" name="submit" id="submit" value="Create"  class="btn btn-info"&gt;
  
  
          &lt;/form&gt;
          &lt;a href="&lt;? echo base_url()."/index.php/Tmcq_test";?&gt;"&gt; &lt;button class="btn btn-info"&gt; Exit  &lt;/button&gt; &lt;/a&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;?php include_once('footer.php'); ?&gt;
  </code></pre>
  
  <p>Here i am possible to check all the filed must fill up.
  But in second condition in </p>
  
  <pre><code>    for(var z=1;z&lt;=j;z++)
  //var qus2=document.forms["myForm1"]["ques[" + z + "]"].value;
  var opt4=document.forms["myForm1"]["opt1[" + z + "]"].value;
  var opt5=document.forms["myForm1"]["opt2[" + z + "]"].value;
  var opt6=document.forms["myForm1"]["opt3[" + z + "]"].value;
  var ans2=document.forms["myForm1"]["ans[" + z + "]"].value;
  
  if ((opt4||opt5||opt6)==ans2)
    {
    //alert("answer not match");
  return true;
    }
    else{
    alert("answer not match");
    return false;
    }
  
  //return true;
  }
  }
  </code></pre>
  
  <p>how i check that at least one option value must match with answer ?
  what is the condition i need to use ?</p>