Hide some properties

I need to do JS manipulations, for example to remove some element from DOM.

how can i do it?
Please send me some snippets for that.

Thank you!

Hey, you probably should give some more details. Keep in mind that in Jira Cloud your app runs in an iframe and you can’t really interact with elements which are outside of your app.
In general, for elements that you render, you can use the DOM API

Something like

const myElement = document.getElementById("myElementId")

when i am using document, or window or other thing, i have this error

Oh you’re on Forge, in that case you should use React to conditionally render or hide your elements.

Stuff like

const App = () => {
  const [show, setShow] = useState(true)

  return (
       {show && <Text>Now you see me</Text>}
       <Button onClick={() => setShow(show => !show)}>{show ? 'Hide' : 'Show'}</Button>

and of course you won’t be able to hide or interact with elements which are not created by your app.

1 Like

no, i need to select an element from DOM and need to run .remove() (delete element from dom).

What are you trying to remove from the DOM? Is it something that comes from your app?
If it doesn’t, you just can’t do it: it would be a mess if every app could possibly interact with each other – and would be a huge security risk.

If you want to remove an element that you rendered using React, you can do it with refs, but you should explain what you’re trying to do.

1 Like

So… a couple of things.
You’re using ForgeUI - that’s a really controlled environmnet where I don’t think that the document object exists.

Even if you were using CustomUI - you’d be limited to the iframe that you’re in.

Either way - in Atlassian Cloud - you’re restricted to playing in your iframe (depending on what it allows).

1 Like

i need to hide this column in the task.

Hello, thanks for your reply.
i need to hide this column in the task.

Well… you can’t. As Daniel and I have explained to you, there is no way to remove elements that aren’t rendered by your app.


Thank you so much guys