title: Regex to match carriage return in Javascript
body: <p>I am trying to write some Javascript to hide some elements that contain only carriage returns. I appreciate that the correct way to solve this problem would be to stop these elements being created, but unfortunately that is not possible in this instance. I am trying to user a regular expression to search for the unwanted elements but am not having much luck. The function I have written is as follows:</p>
  
  <pre><code>function HideEmptyP()
  {
  
      var patt = (\\r)
      for(var i = 0;i&lt;desc[i].length;i++);
      {
      var desc[i] = document.getElementsByClassName('sitspagedesc');
      var result[i] = patt.test(desc[i]);
          if (result[i] == true)
              {
              desc[i].style.display='none';
              }
          else
              {
              alert("No Match!");
              }
      }
  </code></pre>
  
  <p>The error I'm getting in the Web Console is 'Syntax Error: Illegal Character'. </p>
  
  <p>Grateful for any ideas on how to solve this.</p>
  
  <p>Thanks in advance.</p>