我需要在jquery中查詢選擇值爲「」的元素。我在IE中工作,但沒有在Chrome中。我認爲chrome有另一個價值作爲非定義價值。在鉻中查找具有未定義值的元素
我的查詢:
var images = $('#images>div>input[type=file][value=""]');
if(images.length > 0) // ...
正如你可以看到有這給用戶一個機會,附加圖像文件類型的輸入元素。
<div id="files">
<div><input type="file" name="files" /><input type="button" value="Remove" onclick="removeImage(this)" /></div>
<div><input type="file" name="files" /><input type="button" value="Remove" onclick="removeImage(this)" /></div>
<div><input type="file" name="files" /><input type="button" value="Remove" onclick="removeImage(this)" /></div>
</div>
在IE中,它工作的很好,但在鉻它總是返回0個元素。
你有任何解決方案可以在每個瀏覽器上工作嗎?
你可以發佈標記(HTML)嗎? (另外,你嘗試過哪些版本的IE?) – Pointy