You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing a custom widget and my script seems to be loading before Elementor renders.
My main concern is I can't seem to query elements while in editor mode.
Example
PHP - widget class
protected function render() {
?>
<div class="map"></div>
<?php
}
JS
document.querySelector('.map')
On the frontend my script is able to find the element but in the editor mode, it returns null. Is there something I'm particularly missing? I've attempt to load my js file using different hooks https://code.elementor.com/php-hooks/. but that doesn't seem to help. I'm a bit at lost.
This discussion was converted from issue #8589 on June 24, 2021 21:47.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm writing a custom widget and my script seems to be loading before Elementor renders.
My main concern is I can't seem to query elements while in editor mode.
Example
PHP - widget class
JS
On the frontend my script is able to find the element but in the editor mode, it returns null. Is there something I'm particularly missing? I've attempt to load my js file using different hooks https://code.elementor.com/php-hooks/. but that doesn't seem to help. I'm a bit at lost.
Beta Was this translation helpful? Give feedback.
All reactions