I am newbie in jQuery, but I try to learn it.
Let’s say I got input with id=”userForm:id”;
In javascript I can simple get id by:
var id = document.getElementById("userForm:id");
In jQuery I try:
var id = $('#userForm:id');
but then I get error:
Uncaught Error: Syntax error, unrecognized expression: unsupported
pseudo: id
jQuery thought of this problem already, and you only need to escape it, as detailed in the jQuery docs and in more detail in the jQuery FAQ:
The same is true of periods and other characters that are valid ID characters but have special CSS meaning.
As a general matter of style, I’d personally discourage you from using special characters (i.e. anything besides alphanumeric, underscores and slashes) in your HTML id properties, but there’s certainly no technical reason why it can’t be done.