Hide Elements

How do we hide HTML elements in specific languages?

Ishai Jaffe avatar
Written by Ishai Jaffe
Updated over a week ago

Hide Elements

You can use the class "bablic-hide-all" to hide element in all translated languages or "bablic-hide-{locale code}" to hide elements only in a specific language. Usually it's best to also add the "bablic-exclude" attribute on elements that are hidden in all languages

class="bablic-hide-all" Bablic will hide this element in all translated languages. It's recommended to also add "bablic-exclude" attribute to those elements.

<span class="bablic-hide-all" bablic-exclude> This text will not show on all translated languages </span>

class="bablic-hide-{locale code}" Bablic will hide this element in that specific language.

<div class="bablic-hide-fr" >     This element will be hidden only on French</div>

 If you don't have access to the HTML itself, but you do know how to identify the elements to be hidden simple use Javascript:

bablic.on('locale',function(languageCode) { 
   $('#elementsToHideOnFrench').toggle(languageCode != 'fr');
});
Did this answer your question?