Jquery 在引号中设置引号
问题描述:
我有这样的代码:
$("input[id="+id.slice(0,-1)+"-br-"+brand+"].qnt_to_cart").show();
产生我:
input[id=02620-br-FEBI BILSTEIN].qnt_to_cart
但我需要看到类似的东西:
But i need to see something like:
input[id="02620-br-FEBI BILSTEIN"].qnt_to_cart
那我需要写什么?如何在报价中设置报价?
So what i need to write? How to set quote in quote?
更新
为什么我仍然看到:
Uncaught Error: Syntax error, unrecognized expression: input[id=02620-br-FEBI BILSTEIN].to-cart
答
使用 \"
转义引号:
$("input[id=\""+id.slice(0,-1)+"-br-"+brand+"\"].qnt_to_cart").show();