title: Selecting Chosen options through javascript functions
body: <p>I've been trying to implement a solution proposed in <a href="https://stackoverflow.com/questions/314636/how-do-you-select-a-particular-option-in-a-select-element-in-jquery/15159735#15159735">How do you select a particular option in a SELECT element in jQuery?</a> to no avail.  Either the addition of Chosen to the mix makes the solution invalid, or I've made some coding error that is beyond my compiler and me to find.</p>
  
  <p>My html:</p>
  
  <pre><code>&lt;select name="superType" class="chosen-select chosen-select-creation-allowed" id="superType" style="width: 300px; display: none;" onchange="loadInheritance()" multiple=""&gt;
    &lt;option style="padding-left:20px;" value=""&gt;&lt;/option&gt;&lt;option style="padding-left:0px" value="28"&gt;concept&lt;/option&gt;
    &lt;option style="padding-left:20px" value="30"&gt;human&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>When I place the following after this, I expect one of them will add to the value="30" option above a 'selected' attribute:</p>
  
  <pre><code>      //$('#superType option[value="30"]').prop('selected', true);
          $('#superType option[value="30"]').attr('selected', 'selected');
          $('.chosen-select').trigger("chosen:updated");
  </code></pre>
  
  <p>Instead, nothing happens as according to the DOM model inspector and visual presentation.</p>
  
  <p>What I want is to have this selection happen inside a function, but when I try to build the reference to the option above I get the error:</p>
  
  <pre><code>Syntax error, unrecognized expression: '#superType option[value="30"]'
  </code></pre>
  
  <p>Here is the javascript generating that (procs on 'cid'):</p>
  
  <pre><code>            //now go back through and select the ones this CommonNoun already had from before
              $.ajax({
                  url: '/BackToTech/server?function=getExistingSuperTypes',
                  type: 'POST',
                  success: function (response){
      //              var target = $("#superType");           
                      var target = "#superType";          
                      selectOptions(response, target, 0);
                      $('.chosen-select').trigger("chosen:updated");
                  }
              });
  </code></pre>
  
  <p>...</p>
  
  <pre><code>function selectOptions(obj, target) {
      var concepts = obj; 
      $.each(concepts, function(concept, value) {  
          alert(concept, value);
          if (concept == "cid") {
              optionValue = obj[concept].oid;
              $("'" + target + " option[value=\"" + optionValue + "\"]'").attr('selected', 'selected');
          } else { 
              selectOptions(value, target);
          }
      });
  } 
  </code></pre>