First plugin

Hello
I created code that should hide element in my browser, but it doesn’t work
browser.runtime.onMessage.addListener(function(message) {
if (message.action === ‘hideFormRow’) {
const formRows = document.querySelectorAll(’.form-row’);
formRows.forEach(formRow => {
const span = formRow.querySelector(’.label-text’);
if (span && span.textContent.includes(‘myText’)) {
formRow.style.display = ‘none’;
}
});
}
});

Does brower support such hiding?
I send greetings

You’re probably wondering why nobody’s answered your question.

  1. Please format your code properly.
    On my computer, it looks like this:
    Unformatted_Code
  2. You wrote that “it doesn’t work”.
    That doesn’t tell us very much. If you want help, you need to give us more information.
    a) Edit your question and add the code of all files in your extension. Start with manifest.json
    b) Give us the URL of a website where you want to use the extension, so that we can see for ourselves what doesn’t work any why.
    c) Please read Debugging and then tell us if there are any error messages.
  3. Change the title of your thread to something more informative, maybe:
    Extension doesn’t hide element on webpage
  4. Move your post to “Addons Development” when you edit it.
    (But I’m not sure if you can do this as a new forum member)
1 Like

I don’t know how to edit sorry