title: Tooltip with shortened characters in divs
body: <p>The following <code>code</code> will:</p>
  
  <ol>
  <li>Test to see if the characters in a <code>div</code> are more then ten chars long</li>
  <li>Shorten the text to less than ten characters</li>
  <li>Append <code>...</code> to the <code>div</code></li>
  <li>On hover, it will show and hide a <code>div</code> that is intended to show the full text</li>
  </ol>
  
  <p>I edited this once I found one of the problems</p>
  
  <p>so far it works with only the first div and no others</p>
  
  <pre><code>&lt;html&gt;
  
  &lt;head&gt;
  
  &lt;title&gt;limit chars 1&lt;/title&gt;
  &lt;script type="text/javascript" language="javascript" src="jquery.js"&gt;&lt;/script&gt;
  
  
  &lt;script type="text/javascript"&gt;
  
    $(document).ready(function() {
  
  
        $("#div2").hide();
  
  var elem = $("#div1");
  var fn1 = function(){ $('#div2').show();};
  var fn2 = function(){ $('#div2').hide();};
  
  
      if(elem){
          if (elem.text().length &gt; 10)
           elem.text(elem.text().substr(0,12)
  
  
      )}
  
      if(elem){
      if (elem.text().length &gt; 10) 
      elem.text(elem.append("...")
     )};
  
  
  
  
  
      if(elem){
      if (elem.text().length &gt; 10) 
      //elem.text(elem.append("...")
  
  
    $(elem).mouseover(fn1).mouseout(fn2);
  
  
  
     };
  
  
  //$(elem).mouseover(fn1).mouseout(fn2);
  
    });//end
  &lt;/script&gt;
  
  &lt;style&gt;
  
  #div2{color:blue; }
  
  &lt;/style&gt;
  
  
  
  
  &lt;/head&gt;
  
  
  &lt;body&gt;
  
  this is where the fun begins.
  &lt;div id="div1"&gt;
  12345ebfkqbweub qiuweiu 
  &lt;/div&gt;
  &lt;div id="div2"&gt;full text in tooltip&lt;/div&gt;
  
  
  &lt;/body&gt;
  
  
  
  &lt;/html&gt;
  </code></pre>