title: Jquery what is the difference between $(#id) and $([id=])
body: <p>I was a bit confused when I encountered this in my programm. So I was wondering if anyone knew what could be the deal here. I am fairly new to Jquery after all.</p>
  
  <p>Why does:</p>
  
  <pre><code>$('[id="' + nameOftheID + '"]').append("Append some text");
  </code></pre>
  
  <p>work for me.</p>
  
  <p>Yet</p>
  
  <pre><code>$("#" + nameOftheID).append("Append some text");
  </code></pre>
  
  <p>does not work for me.
  In this case the 'nameOftheID' is a var that is exactly the same as the ID of the <strong>span</strong> I am trying to append some text to (I tested and confirmed this in debugging). Why is it that the normal # selector for selection based on ID's does not append the text for me. but the other method does?</p>
  
  <p>My code works in the end. I just want to know why A works and B doesnt.</p>
  
  <p>The name of my ID is "Ruleset[0].Conditions[0]"</p>