我从json响应生成一个HTML,这可以是任何数据。jquery在ID中输入特殊字符
标识可以是任何东西像
Blue & White Dress
Black Dress
我试着像
$("['id="+dressId+"']").prop('checked', false);
但还是jQuery是抛出一个错误,说
Error: Syntax error, unrecognized expression: ['id=Blue & White Dress']
能不能介绍一下这方面的帮助?
谢谢,Inadvance。
我想你可能会在各地都有你的引用标记,试试这个。 $('[id =''+ dressId +'“]') – MCMXCII
你的id中有空格。你不能:http://stackoverflow.com/questions/70579/what-are-valid-values-for-the-id-attribute-in-html –
@ MCMXCII,谢谢你的答复。你可以添加这个为一个答案。所以我可以接受答案。 – sree