I have the following example code, creating a object collection.
How can I remove one of the objects? (e.g. $TestList would look as though the "delete me" item was never there. I've tried .remove, .splice, .delete etc but I'm told it's not a function.
Doing typeof($TestList) brings back object, and typeof($TestList[0]) also seems valid.
Surely I don't have to recreate the collection without one item?
(function($) {
jQuery.QuickTest = {
$TestList: {},
build: function()
{
$TestList={};
$TestList[0] =
{
title: "part 1"
};
$TestList[1] =
{
title: "delete me please"
};
$TestList[2] =
{
title: "part 2"
};
}
}
jQuery.fn.QuickTest = jQuery.QuickTest.build;
})(jQuery);
$(document).ready(function() {
$().QuickTest(
{
})
});
We're using jQuery 1.3.
Thanks!
$()only start working since 1.4? Besides that, could you share with us what this piece of code is supposed to do?$TestListis implied global, which is a bad idea.$()would return a jQuery object containing thedocumentelement.