Javascript help needed

Hi there!

I have 0.1% understanding of Javascript but I think I’m almost there with what I’m trying to achieve, could anyone with a better understanding help me out please?

I’m trying to use an emoji picker in every comment input in the feed, and a modal when opening a specific post. It works in the modal, but doesn’t do anything in the feed:

It works as intended in the modal:

<script type="module">

import 'https://cdn.jsdelivr.net/npm/emoji-picker-element@^1/index.js'
import insertText from 'https://cdn.jsdelivr.net/npm/insert-text-at-cursor@0.3.0/index.js'

document.querySelector('emoji-picker[id="551"]').addEventListener('emoji-click', 
e => {insertText(document.querySelector('input[id="text3"]'), e.detail.unicode)})

</script>

It doesn’t work in the feed input

<script type="module">

import 'https://cdn.jsdelivr.net/npm/emoji-picker-element@^1/index.js'
import insertText from 'https://cdn.jsdelivr.net/npm/insert-text-at-cursor@0.3.0/index.js'

document.querySelector('emoji-picker[id="7"]').addEventListener('emoji-click', 
e => { insertText(document.querySelector('input[id="text33312"]'), e.detail.unicode)})

</script>
Community Page
Last updated: