title: inline if else statements in jQuery
body: <p>I have a jQuery function that is executed by two different buttons.</p>
  
  <pre><code>$("#btnSearch, #btnDirectorSearch").click(function () {
  </code></pre>
  
  <p>Part of the html that this function builds depends on which button was hit. I am using data- attributes to store my variables like this:</p>
  
  <pre><code>var div = $(this).data("str");
  </code></pre>
  
  <p>And the html string I am building depends on what value the variable "div" is.  Is there a way to do an inline if/else statement in jQuery? </p>
  
  <pre><code>if div = "choice1" {
      html += '&lt;tr data-str = "str1" data-dataItem = "dataItem1" data-result-title = "' + name + '" data-result-id="' + sel + '"&gt;';
  
  } else {
      html += '&lt;tr data-str = "str2" data-dataItem = "dataItem2" data-result-title = "' + name + '" data-result-id="' + sel + '"&gt;';
  }
  </code></pre>
  
  <p>That seems cumbersome and I'm hoping there is a better jQuery way of doing this.</p>
  
  <p>Thanks!</p>