document.getElementsByClassName
returns an HTMLCollection
(an array-like object) of all elements matching the class name. The style
property is defined for Element
not for HTMLCollection
. You should access the first element using the bracket(subscript) notation.
document.getElementsByClassName('appBanner')[0].style.visibility = 'hidden';
To change the style rules of all elements matching the class, using the Selectors API:
[].forEach.call(document.querySelectorAll('.appBanner'), function (el) { el.style.visibility = 'hidden'; });
If for...of
is available:
for (let el of document.querySelectorAll('.appBanner')) el.style.visibility = 'hidd
Related Posts:
- Edit webpage with javascript trick – how to “unedit”?
- Automatically pausing html5 video as the ‘next’ button is pressed (javascript/ jquery)
- Is it possible to write data to file using only JavaScript?
- Remove CSS class from element with JavaScript (no jQuery) [duplicate]
- Is it possible to write data to file using only JavaScript?
- How to make JavaScript execute after page load?
- Set cookie and get cookie with JavaScript
- Which is better: or
- Onclick javascript to make browser go back to previous page?
- How to make JavaScript execute after page load?
- Why is my Javascript not working?
- How can I get the values of data attributes in JavaScript code?
- Javascript: getElementById vs getElementsById (both works on different pages)
- mailto using javascript
- mailto using javascript
- Mailto using Javascript?
- How to change css property using javascript
- javascript close current window
- I am trying to make a simple toggle button in javascript
- How to call a JavaScript function within an HTML body
- How to save user input into a variable in HTML and JavaScript
- Hiding a button in Javascript
- Show/hide ‘div’ using JavaScript
- How to make JavaScript execute after page load?
- Get HTML code using JavaScript with a URL
- Calculate percentage Javascript
- How to display image with JavaScript?
- Resize image with javascript canvas (smoothly)
- JavaScript function onhover in
- Check if an element contains a class in JavaScript?
- How to play a mp3 using Javascript? [duplicate]
- mailto using javascript
- Function not defined javascript
- How to submit a form with JavaScript by clicking a link?
- How to call a REST web service API from JavaScript?
- Check a radio button with javascript
- AppendChild() is not a function javascript
- How can I change an element’s class with JavaScript?
- JavaScript: Get image dimensions
- Why write script type=”text/javascript” when the mime type is set by the server?
- How to select an input element by value using javascript?
- javascript window.location in new tab
- How to create a hidden in JavaScript?
- How do I programmatically set the value of a select box element using JavaScript?
- How can I capture the right-click event in JavaScript?
- How do I clear the content of a div using JavaScript?
- Open link in new tab or window [duplicate]
- Failed to load resource: the server responded with a status of 404 (Not Found) css
- reCAPTCHA ERROR: Invalid domain for site key
- Can I have an onclick effect in CSS?
- How to style a checkbox using CSS
- Check if checkbox is checked with jQuery
- Parse error: Syntax error, unexpected end of file in my PHP code
- CSS Background Image Not Displaying
- How can I hide the full url of my website?
- How to check View Source in Mobile Browsers (Both Android && Feature Phone)
- How to read xml file contents in jQuery and display in html elements?
- Center form submit buttons HTML / CSS
- CSS: Moving the text down a few pixels but keeping the background still?
- What are .tpl files? PHP, web design
- How to use css first-child with :not()
- How to keep footer at bottom of screen [duplicate]
- How to embed a PDF viewer in a page?
- Align DIV’s to bottom or baseline
- Partial render in HTML/JavaScript
- Wrap text around bootstrap image
- Showing an image from an array of images – Javascript
- Set value to currency in
- Angular 2 Checkbox Two Way Data Binding
- How to center a navigation bar with CSS or HTML?
- center aligning a fixed position div
- HTML Entity Decode
- link with target=”_blank” does not open in new tab in Chrome
- How to make new page in html?
- How do I escape ampersands in XML so they are rendered as entities in HTML?
- How to draw a trapezium/trapezoid with css3?
- How to make music autoplay and loop in background
- jQuery sort elements using data id
- send mail to multiple receiver with HTML mailto [duplicate]
- Rails button_to vs. HTML Button Tag
- Stray end tag “head”
- JavaScript code to stop form submission
- How to create a text box in PHP to output data
- Auto refresh code in HTML using meta tags
- Default text on input
- position fixed is not working
- Place a button right aligned
- Editing page content through FTP?
- Is absolute control possible with WordPress
- HTML Entities displaying improperly as malformed escaped code
- Add Piwik Tracking code to page
- Anchor tag in the entry-utility section ( the Posted in…part) appears from nowhere?
- Remove lines around an HTML table in Gutenberg block
- Main menu effect visited
- iframe works on a page, but not a single, why?
- HTML block code breaking
- Display html code, not the tags
- Prevent markup being altered when switching between Visual and HTML editors
- How to display html code normally?
- Modal pop-up HTML code works on other sites or HTML viewers but not in the custom HTML block within a wordpress page?