Runtime update style by code not work

I want to hide a element by code. And I can get the element’s reference. The method doesn’t work just like the picture.
7206226--865561--upload_2021-6-4_17-16-40.png

And I also try to modify “class”, not work similarly.
7206226--865564--upload_2021-6-4_17-19-38.png

Is there anything missing? I can manual set “display” by UI Toolkit Dubugger, and the UI works well. But how to do that by Script?

Maybe I did not understand question but is this not what you are looking for? This is how I hide element. .....style.display = DisplayStyle.None;

The problem is that the code doesn’t work for me. And all modify element style by code don’t work.

update: What I manipulated element is out of screen, and I didn’t noticed it. Now it’s all right.