For JavaScript arrays, you use push()
.
var a = [];
a.push(12);
a.push(32);
For jQuery objects, there's add()
.
$('div.test').add('p.blue');
Note that while push()
modifies the original array in-place, add()
returns a new jQuery object, it does not modify the original one.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…