From 7a6707374f231d9cb07476c9453727ee5c6c9a45 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Tue, 14 Feb 2023 12:27:01 +0530 Subject: Using on loaded scripts for chaning styles. --- src/utils/styling.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/utils/styling.ts (limited to 'src/utils/styling.ts') diff --git a/src/utils/styling.ts b/src/utils/styling.ts new file mode 100644 index 0000000..0e527d9 --- /dev/null +++ b/src/utils/styling.ts @@ -0,0 +1,8 @@ +export const styles = (selector: string, styles: { [key: string]: string }) => { + const elements = Array.from(document.querySelectorAll(selector)) as HTMLElement[]; + for (const element of elements) { + for (const styleType in styles) { + element.style[styleType as any] = styles[styleType]; + } + } +}; -- cgit v1.2.3