什么是'>'在javascript中的意思? [英] What does '>' mean in javascript?
本文介绍了什么是'>'在javascript中的意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下javascript中(#todoList> div)的>符号是什么意思?
$('#btnClear ').click(function(){
$('#todoList> div')。each(function(){
var entity = $(this).data('entity');
$ todo.context.TodoEntries.remove(entity);
});
$ todo.context.saveChanges(updateView);
});
在HTML文件中,#todoList是div的id。
< div id =todoList>< / div>
在此语句中
$('#wrapper> div:not(#providerSelection)')
解决方案
这不是JavaScript语法,而是CSS选择器语法, / p>
这是直接子级选择器
这意味着它从id todoList
的元素中选择所有作为子节点的div元素。 。
这将适用于id为A和B的元素:
< div id =todoList>
< div id = A>
< div id = C>
< / div>
< span id = D>< / span>
< div id = B>< / div>
< / div>
What does the > sign mean in (#todoList > div) in the following javascript?
$('#btnClear').click(function () {
$('#todoList > div').each(function () {
var entity = $(this).data('entity');
$todo.context.TodoEntries.remove(entity);
});
$todo.context.saveChanges(updateView);
});
In the Html File the #todoList is the id of a div.
<div id="todoList"></div>
And in this statement
$('#wrapper>div:not(#providerSelection)')
What is ":not"?
解决方案
It's not JavaScript syntax but CSS selector syntax, here passed in a JQuery selector.
It's the "direct child" selector.
It means it selects all div elements that are child nodes one level down from the element with id todoList
.
This would apply to elements with id A and B here :
<div id="todoList">
<div id=A>
<div id=C>
</div>
<span id=D></span>
<div id=B></div>
</div>
这篇关于什么是'>'在javascript中的意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文