我受审
d3.select(".cell:first")
d3.selectAll(".cell").filter(":first")
d3.selectAll(".cell").select(":first")
工作
我受审
d3.select(".cell:first")
d3.selectAll(".cell").filter(":first")
d3.selectAll(".cell").select(":first")
工作
<代码>d3.select(优等)已经选定了第一个对应要素:
选择与特定甄选者扼杀相对应的第一个要素,退回单一要素选择。 如果本文件中没有任何内容与特定的甄选者相匹配,则将空选取回。 如果多重因素与甄选者相匹配,将只选定第一个匹配要素(在文件处理中)。
资料来源:https://github.com/mbostock/d3/wiki/Selections#wiki-d3_select。
D3似乎将<代码>d3.selectAll()的成果退回到一个阵列中。 例如,请在d3 主页。 结果:
[ Array[32] ] // An array with a single array child. Child has 32 paragraphs.
因此,如果我们想从这一收集中得到最后一段,我们就可以做以下工作:
var paragraphs = d3.selectAll("p");
var lastParag = paragraphs[0].pop();
更简明扼要:
var obj = d3.select( d3.selectAll("p")[0].pop() );
The :last-child
selectedor isn t the same as 带上最后一页。 这名选择人将给你作为母集装箱最后一名子女的内容。 考虑以下标记:
<div id="foo">
<p>Hello</p>
<p>World</p>
<div>English</div>
</div>
<div id="bar">
<p>Oie</p>
<p>Mundo</p>
<div>Portuguese</div>
</div>
在这种例子中,d3.select(>p:last-child”>
赢得了任何段落的回报。 甚至<代码>d3.selectAll(“p:last-child”)> 这些集装箱中没有一个是最后一段(即<div>
s:<div>English</div>
和<div>Portuguese</div>
。
如果你想从D3的甄选中获取第一种OM要素,则使用<代码>.node()方法:
var sel = d3.selectAll( p ); // all <P>, wrapped with D3.selection
var el = sel.node(); // the first <P> element
How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.
I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...
Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...
Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...
I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...
Is it possible for someone to give me a few pointers on how to display a multidimensional array in the form of a bar graph? The array is multidimensional, with three elements in each part - and the ...
Is it possible to reload a form after file-input change? I have a form where the user can chose an image for upload. I also have a php script which displays that image resized. I only wonder if it ...
I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.