Elements with $ in the id can’t be altered in jquery

Since $ is a meta characters, use \\ to escape it.

$("#te\\$t").hide();

Docs

To use any of the meta-characters ( such as !”#$%&'()*+,./:;<=>?@[]^`{|}~ ) as a literal part of a name, it must be escaped with with two backslashes: \\.

Leave a Comment