鍍金池/ 問(wèn)答/HTML/ js 中獲取元素內(nèi)容和顯示的不一樣。

js 中獲取元素內(nèi)容和顯示的不一樣。

js 中獲取元素內(nèi)容和顯示的不一樣。

console.log(this.children(this.children(item.parentElement,'item-detail')[0],'item-count')[0])
console.log(this.children(this.children(item.parentElement,'item-detail')[0],'item-count')[0].innerHTML);

控制臺(tái)輸出是這樣

回答
編輯回答
我不懂

我知道了,你在console.log后又改了元素的值,所以console.log元素的話(huà),會(huì)顯示修改后的元素
https://jsfiddle.net/2s66wh6t/1/

2018年1月9日 15:22
編輯回答
初心

有相同的class類(lèi)名吧

2017年12月6日 22:56