Jquery 在引号中设置引号 [英] Jquery set quotes in quote
本文介绍了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();
这篇关于Jquery 在引号中设置引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文