# Imperative

As an alternative to the declarative way, you can create Dropzones imperatively (even on non `<form>`elements) by instantiating the `Dropzone` class:

{% tabs %}
{% tab title="Plain JavaScript" %}

```javascript
// The constructor of Dropzone accepts two arguments:
//
// 1. The selector for the HTML element that you want to add
//    Dropzone to, the second
// 2. An (optional) object with the configuration
let myDropzone = new Dropzone("div#myId", { url: "/file/post"});
```

{% endtab %}

{% tab title="jQuery" %}

```javascript
// The dropzone method is added to jQuery elements and can
// be invoked with an (optional) configuration object.
$("div#myId").dropzone({ url: "/file/post" });
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Don’t forget to specify an `url` option if you’re not using a `<form>` element, since Dropzone doesn’t know where to post to without an action attribute. On form elements, Dropzone defaults to the `action` attribute.
{% endhint %}

For a list of all configuration options, refer to the [configuration section](/configuration/basics.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dropzone.dev/getting-started/setup/imperative.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
