I was trying to use Custom Script section on the page and write something like this there:
document.getElementsByClassName(‘navigation’).style.display = ‘none’;
But it doesn’t seem to work. Can you help me figure this out?
I was trying to use Custom Script section on the page and write something like this there:
document.getElementsByClassName(‘navigation’).style.display = ‘none’;
But it doesn’t seem to work. Can you help me figure this out?
@famousright, Google can help too…
When searching for getElementsByClassName, Google will return the following page as first entry in its results: Document.getElementsByClassName() - Web APIs | MDN
According the docs:
The
getElementsByClassName
method ofDocument
interface returns an array-like object of all child elements which have all of the given class name(s).
In the Examples section:
Get the first element with a class of ‘test’, or
undefined
if there is no matching element:
document.getElementsByClassName('test')[0]
But this is still not working. Can I just write scripts in this section?
Custom Script section
We are using our company custom theme.
Then you should ask the developers of the theme… The community has no insight in the custom theme used by your company.
Isn’t this universal for all themes? Can theme block custom scripts?
@famousright, No there is no universal “Custom Script section” in Grav themes.
By the way, why would you want to hide an element with class “navigation”?
Anyway, I would suggest you talk to the developers of the custom theme used by your company.
I can’t reach them anymore because they are not working at the company.
There is a Custom Script section on the page where I want execute this script. I just don’t know why it may be not working.
I want to hide navigation because this is what requested by our company for this page
I can’t reach them anymore because they are not working at the company.
If the agency or internal developers can no longer be reached, your company might consider:
Again, without the community knowing what the “Custom Script section” does and not being able to dig into the code of the theme, there is not much we can do here…