MarkupRefineLib

Menu


Resettable file input

Add data-mr-resettable-file to the wrapper. The enhancement adds mr-file-input without replacing classes already owned by the application, and creates a reset button withdata-mr-file-reset. Resetting emits a bubblingchange event and returns focus to the native file input. Without JavaScript the ordinary file input remains fully usable.

Example usage

<form>
  <div class="my-upload-field" data-mr-resettable-file>
    <label for="attachments">Attachments</label>
    <input id="attachments" type="file" multiple>
  </div>
</form>

Rendered example