理由は表の行ごとにIDを埋め込んで、
クリックするとそのIDにいれたパラメータでAJAXでデータ取得し、
行を追加しようと思ったからです。
HTML自体で使えるIDについては、
W3CのBasic HTML data types に
ID and type::NAME">NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
とあります。
jQueryのセレクタで使える文字については、 Selectors – jQuery API で、
If you wish to use any of the meta-characters ( such as
!"#$%&'()*+,./:;<=>?@[\]^`{|}~
) as a literal part of a name, you must escape the character with two backslashes: \\
. For example, if you have an element with id="foo.bar"
, you can use the selector $("#foo\\.bar")
. とメタキャラクタの入力には\\(バックスラッシュ2つ)を入れる必要がありますので、
そのまま使える記号は 「 - 」 「 _ 」 ということになります。