In D8 I've created a view and assigned it into a block,

  1. I've created corresponding template for both view and block.
  2. Most of the unwanted addition of div's and classes has been removed.

But the following empty div is still there in the rendered HTML

<div class="js-view-dom-id-e0cc1fe812f18c9b5d6660b04594c41b597ae5ee9b28cf43f718dc43b43a2f42">

Anyone experienced the same issue?

4 Answers 4


Is the view empty? AFAIK that's the div where the view results should be (may somebody correct me if I'm wrong).

And here's some info in general about what this class is all about: https://www.drupal.org/node/2573529


Semantic Views makes unformatted styles, field row styles and other output more readily configurable without needing to override template files.

unfortunately it doesn't support drupal 8 yet.


I did it overriding the views-view.html.twig template.

In your theme (or module) just duplicate the default template (from /core/modules/views/templates) and name it views-view--MYVIEW.html.twig

In the code, comment the div in the top (and the closing in the bottom):

{#<div{{ attributes.addClass(classes) }}>#}
  {{ title_prefix }}
  {% if title %}
    {{ title }}
  {% endif %}
  {% if feed_icons %}
    <div class="feed-icons">
      {{ feed_icons }}
  {% endif %}

The empty div with the js-view-dom-id class is added by Views in Drupal 8 as a placeholder for the view content, so it can be updated dynamically via AJAX without reloading the entire page. If you don't need this feature, you can disable it in the view settings by following these steps:

  1. Edit the view and click on the "Advanced" section in the left sidebar.
  2. Under the "Other" category, find the "Use AJAX" option and uncheck it.
  3. Save the view and clear the cache.

This should remove the empty div from the rendered HTML. If it's still there, you may need to modify the view template and remove it manually. In your view template file, you can look for the js-view-dom-id class and remove the corresponding div element. Note that this may affect the functionality of the view if you rely on AJAX updates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.