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.
Why does:
$('[id="' + nameOftheID + '"]').append("Append some text");
work for me.
Yet
$("#" + nameOftheID).append("Append some text");
does not work for me. In this case the 'nameOftheID' is a var that is exactly the same as the ID of the span 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?
My code works in the end. I just want to know why A works and B doesnt.
The name of my ID is "Ruleset[0].Conditions[0]"