title: I am trying to trim the output of a jQuery function
body: <p>I am modifying a third-party script so that I can style the output.</p>
  
  <p>Here is a segment of the original code:</p>
  
  <pre><code>var tip_content = $('&lt;div&gt;').addClass('tip_content').load(url, function() {
  </code></pre>
  
  <p>Which produces this output:</p>
  
  <pre><code>&lt;div class="tip_content"&gt;
  </code></pre>
  
  <p>I need to add another class to the output to style it differently on each page. Therefore, it seems like a good solution to add the current html page file name as a class.</p>
  
  <p>But I have no experience with JS. </p>
  
  <p>Here is what I've managed to mangle together:</p>
  
  <pre><code>var tip_content = $('&lt;div&gt;').addClass('tip_content '+elem.attr('href')).load(url, function() {
  </code></pre>
  
  <p>Which produces this:</p>
  
  <pre><code>&lt;div class="tip_content tickets.php?id=185"&gt;
  </code></pre>
  
  <p>This is almost exactly what I need. But I would be very grateful if someone could demonstrate how to trim the output to:</p>
  
  <pre><code>&lt;div class="tip_content tickets"&gt;    
  </code></pre>