0
我試圖檢測一個字符串的一部分存在,有:的JavaScript的indexOf字符串轉義
if (loopCache.indexOf('<ul class=\"bullet-list-round\">') > -1){ }
當整個字符串作爲一個例子是:
var loopCache = 'Active Life<ul class=\"bullet-list-round\">';
的indexOf不會檢測到,可能是由於逃生問題?
測試在Chrome的控制檯,完美的作品對我來說。你確定你的字符串是一樣的嗎? – ssube 2015-02-10 17:31:29
不能重現:http://jsfiddle.net/3v89rrgd/ – Quentin 2015-02-10 17:32:32
也適合我。 – 2015-02-10 17:32:55