title: How to check if one of values is empty on JSON array using jQuery?
body: <p>I want to assign autocomplete value for hiddenfield only if   'desc'  => $json_result["level"] getting empty result , else 
  autofilter selected values should assign to a hidden field</p>
  
  <p><strong>JSON</strong></p>
  
  <pre><code>       $json=array();
   foreach ($results as $json_result) {
   $json[] = array(
       'value' =&gt; $json_result["id"],
       'label' =&gt;  $json_result["title"],
       'desc'  =&gt; $json_result["level"]
   );
  }
  
  
   echo json_encode($json);
  </code></pre>
  
  <p><strong>jQuery</strong></p>
  
  <pre><code>jQuery(function(){
                jQuery("#searchc").autocomplete({
                    source:'&lt;?php echo JURI::root().'modules/mod_jomdirectory_search/tmpl/classified.php'; ?&gt;',
                      delay: 300 ,
  
                    minLength:1,
  
  
                    select: function(event, ui) {
  
  /*
  </code></pre>
  
  <blockquote>
    <p>this place i need to check , whether the selected value have empty
    value for     'desc'  => $json_result["level"] or not. if its having
    empty values   jQuery('#categories_id').val(ui.item.value); this
    assigning hidden field  part should remove and auto complete work by
    default</p>
  </blockquote>
  
  <p>*/</p>
  
  <pre><code>                      if (this.value = ui.item.label){
                        jQuery('#categories_id').val(ui.item.value);
  
                        return false;
                          }
  
                        if(this.desc == ""  ){
                            jQuery('#searchc').val(ui.item.desc);
                        }
                    }
  
  
                });
  
  
            });
  </code></pre>
  
  <p><strong>Form</strong></p>
  
  <pre><code>    &lt;td&gt; &lt;p&gt;Name&lt;/p&gt;
                      &lt;input type="text" id="searchc" name="searchc"   value="" required=""  /&gt;&lt;/td&gt;
  
                  &lt;td&gt;&lt;p&gt;Location&lt;/p&gt;
   &lt;input type="hidden" id="categories_id" name="categories_id" value="" /&gt;
                      &lt;input type="text" id="addressc" name="address"  /&gt;&lt;/td&gt;
  </code></pre>