2015-05-04 19 views
0

在UI滑塊中的I console.log(event)。它給了我一個對象。在ui滑塊中的event.target jQuery

它有很多屬性。其中一個屬性是target

當我在console上看到它時,它有一個+符號。意味着它包含多個屬性。

enter image description here

我們可以看到它有+符號。這是什麼意思,是target持有一個對象還是數組?

因爲我console.log(event.target)它給我htmlElement。當我console.log(event.target.children)它給我object它包含它的孩子。

enter image description here

+0

你的問題是什麼? –

+0

我只是想知道。 target是一個對象或數組 – Carlos

回答

0

我相信你會得到你正在尋找一個更深入你的問題,從MDN HTMLCollection理解。這應該清除你想知道的內容,並給你下一步工作。

1

快速測試與jQuery滑塊給我的打擊結果.. 其清楚地表明,..

event是一個jQuery對象

event.target爲文檔對象模型(DOM )

enter image description here

+0

window [「ev」]。target return htmlElement。但是當你使用window [「ev」] .target.children它的返回數組。我必須以相同的方式在數組或對象中分配一個值。我該怎麼做 – Carlos

+0

var event = {「target」:「

adfasdf
」,「children」:[1,2,3]}。我怎樣才能通過使用這個對象得到相同的結果。就像如果我使用event.target.children jQuery對象它將返回數組列表。 – Carlos

+0

你可以發佈你的js小提琴嗎? –