0

我有以下代码:

if (json.result=='OK') {
              message="Your correction has been added successfully";
             $("#ShoppingCartView.custom_terms_n_conditions/24").empty();
             $("#ShoppingCartView.custom_terms_n_conditions/24").html('123');
}
alert(message);

有问题:我可以看到带有消息的警报,但是 id="ShoppingCartView.custom_terms_n_conditions/24" 的元素不会改变它的值!这个元素确实存在,我不明白为什么。请帮我。

4

2 回答 2

0

这是您只需要逃避的工作/代码\\

if (json.result=='OK') {
              message="Your correction has been added successfully";
 $("#ShoppingCartView.custom_terms_n_conditions\\/24").html('123');
}
alert(message);
于 2012-07-11T11:16:29.943 回答
-1

您必须使用两个斜杠转义/and字符。.此外,.html将覆盖并因此已经为空:

$("#ShoppingCartView\\.custom_terms_n_conditions\\/24").html("123");
于 2012-07-11T11:05:58.873 回答