title: Jquery Syntax error, unrecognized expression:
body: <p>Why do I get this error and how can I test for it so it wont break, I tried checking for null but obviously that wont work, thanks.</p>
  
  <p>Please don't advice to not write the ID like this as I know its wrong but it is a possibility.</p>
  
  <pre><code>var jsonTest = [
    {
      "myId": "''''''\"\"\"\"'''''''''''''\"#####$'''''",
    }
  ];
  
  alert(jsonTest[0].myId); 
  // Works - alerts the myId
  
  $('#' + jsonTest[0].myId ).length; 
  // Error: Syntax error, unrecognized expression:
  // #''''''""""'''''''''''''"#####$'''''
  </code></pre>