cilphex
cilphex

Reputation: 6096

filepicker.io widget doesn't work if inserted after DOM load

I'm just getting integrated with filepicker.io, and I'm using the very first example they provide with a drag-drop widget.

<input type="filepicker-dragdrop"/>

If already present in the html when the page loads, the custom input converts correctly. However if you add one to the page dynamically later, all you get is a featureless default input:

// Inserts generic featureless text input
$('#some_div').html('<input type="filepicker-dragdrop"/>');

Is there a way to force filepicker to reprocess the DOM and convert newly inserted widgets?

Upvotes: 2

Views: 792

Answers (1)

brettcvz
brettcvz

Reputation: 2381

You'll want to use the constructWidget call on the dom element when it's created and inserted into the DOM. See https://developers.filepicker.io/docs/web/#widgets-programming

Upvotes: 9

Related Questions