replace getElementById for querySelector in widgets

This commit is contained in:
nflnkr 2024-04-25 17:06:42 +03:00
parent 12002ece0c
commit 2d4510d320
2 changed files with 2 additions and 2 deletions

@ -14,7 +14,7 @@ interface Props {
export default function OpenQuizButton({ selector, quizId, fixedSide }: Props) {
const [isQuizDialogOpen, setIsQuizDialogOpen] = useState<boolean>(false);
const portalContainer = !fixedSide && selector ? document.getElementById(selector)! : document.body;
const portalContainer = !fixedSide && selector ? document.querySelector(selector)! : document.body;
return createPortal(
<ThemeProvider theme={lightTheme}>

@ -9,7 +9,7 @@ export class ContainerWidget {
quizId: string;
selector: string;
}) {
const element = document.getElementById(selector);
const element = document.querySelector(selector);
if (!element) throw new Error("Element for widget doesn't exist");
this.root = createRoot(element);