# Jsfl delete element from library item timeline

**URL:** https://forum.kirupa.com/t/jsfl-delete-element-from-library-item-timeline/329670
**Category:** Uncategorized
**Created:** [September 30, 2012, 3:20pm UTC](https://forum.kirupa.com/t/jsfl-delete-element-from-library-item-timeline/329670 "2012-09-30T15:20:22Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bossmonkey](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@bossmonkey](https://forum.kirupa.com/u/bossmonkey)
#### Post date: [September 30, 2012, 3:20pm UTC](https://forum.kirupa.com/t/jsfl-delete-element-from-library-item-timeline/329670/1 "2012-09-30T15:20:22Z")

</div>

Hi,  
I’m somewhat new to JSFL. I’m currently writing a batch process that will cycle through every frame of every item in the library with a linkage, and deletes instances of any other library items with a linkage.  
The only way I could find to delete an element is by making it the document selection and deleting the selection.  
Unfortunately, I can’t get it to select the element. I’ve done a trace, so I know I have the right element stored, but when I run:

```auto
var doc = fl.getDocumentDOM();

...

for (var l = layer.frames[j].elements.length - 1; l >= 0; l--)
{
    element = layer.frames[j].elements[l];
    if (element.elementType == "instance")
        if (element.libraryItem.linkageExportForAS)
        {
            doc.selectNone();
            doc.selection = [element];
            fl.outputPanel.trace(doc.selection.length + " " + element);
            doc.deleteSelection();
            doc.selectNone();
        }
}

```

no selection is made, and the trace reads: 0 [object SymbolInstance]

I also tried fl.selectElement, but I get “fl.selectElement is not a function”

Can anyone see what I’m doing wrong here?
