_counter = 0 def foo(): global _counter _counter += 1 print 'counter is', _counter
Python обычно использует подчеркивания для указания на частные переменные. Единственная причина в C для объявления статической переменной в функции состоит в том, чтобы скрыть его вне функции, которая не является действительно идиоматическим Python.
$("#BaseElement").children("span");
или
$("#BaseElement > span");
См. селекторы jQuery и children ()
.
In the jQuery API, when it refers to 'descendants' it means all levels, and when it refers to 'children' it means only the first level
this will get you all first level children (in your example the first p, div, 2 spans, and last p)
$('#BaseElement > *')