title: Select content <Pre> when mouse click inside <Pre>
body: <p>I wanna select content Pre with single mouse click, and when Click Outside Pre deselect, This Code what I use, But is not working ...</p>
  
  <pre><code>var pres = document.getElementsByTagName('pre');
  for (var i = 0; i &gt; pres.length; i++) {
      pres[i].addEventListener('click', function() {
          var selection = getSelection();
          var range = document.createRange();
          range.selectNodeContents(this);
          selection.removeAllRanges();
          selection.addRange(range);
      }, false);
  }
  </code></pre>
  
  <p>anyOne help ...</p>