Answer the question
In order to leave comments, you need to log in
Is it possible to loop a script for another loop?
Hello.
I want to hide some content in the post loop from Internet Explorer users
If I apply this code
<div id="allbrausers" style="display: block">dddddddd</div>
<script type="text/javascript">
if (navigator.appName == 'Microsoft Internet Explorer') document.getElementById('allbrausers').style.display = 'none';
</script>
Answer the question
In order to leave comments, you need to log in
ID - unique identifier, i.e. they must not be repeated. It is better to assign a class to the elements.
With jQuery:
$(document).ready(function(){
if (navigator.appName == 'Microsoft Internet Explorer') $(".btn").hide();
});
That is, you want to post such a script under each post?...
Just do a search of the content when loading the page... Something like this...
In general, you can make it as an option with conditional comments
<!--[if !IE]>
<div id="allbrausers" style="display: block">dddddddd</div>
<div id="allbrausers" style="display: block">dddddddd</div>
<div id="allbrausers" style="display: block">dddddddd</div>
<div id="allbrausers" style="display: block">dddddddd</div>
<![endif]-->
it is correct to do this:
1 add the class of the current browser to the body (if a person entered with chrome, it will be like this body class="chrome ..", if with ie - body class="ie ..." and so on). how to do it for WordPRess on the internet a lot of tutorials
2 in css add .ie .noie {display:none}
3 in a loop / in any other place add the .noie class to the necessary elements
why other tips are bad:
1 making several duplicate id on the page is not valid
2 hiding elements via jquery is bad - scripts may not load immediately, blocks will be visible
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question