UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

12 lines (11 loc) • 481 B
//#region src/base-ui/Input/clearNativeValue.ts const clearNativeValue = (element) => { if (!element) return; const prototype = element instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype; Object.getOwnPropertyDescriptor(prototype, "value")?.set?.call(element, ""); element.dispatchEvent(new Event("input", { bubbles: true })); element.focus(); }; //#endregion export { clearNativeValue }; //# sourceMappingURL=clearNativeValue.mjs.map