Hide/Show element if IE - Javascript
<p>I am working with a script that pops up an <code>alert</code> if the user is or isn't using IE.</p>

<p>Instead of this, I'd like to show or hide a <code>div</code> element in my page.</p>

<p>I have tried unsuccessfully here: <a href="http://fiddle.jshell.net/shhv1Lx3/2/" rel="nofollow">http://fiddle.jshell.net/shhv1Lx3/2/</a></p>

<p><strong>Working alert demo here:</strong> <a href="http://fiddle.jshell.net/shhv1Lx3/3/" rel="nofollow">http://fiddle.jshell.net/shhv1Lx3/3/</a></p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function GetIEVersion() {
  var sAgent = window.navigator.userAgent;
  var Idx = sAgent.indexOf("MSIE");

  // If IE, return version number.
  if (Idx &gt; 0) 
    return parseInt(sAgent.substring(Idx+ 5, sAgent.indexOf(".", Idx)));

  // If IE 11 then look for Updated user agent string.
  else if (!!navigator.userAgent.match(/Trident\/7\./)) 
    return 11;

  else
    return 0; //It is not IE
}

var e = document.getElementById(ie);
var e2 = document.getElementById(chrome);

if (GetIEVersion() &gt; 0) 
   alert("This is IE " + GetIEVersion());
   e.style.display = 'block';
   e2.style.display = 'none';
else 
   alert("This is not IE.");
   e.style.display = 'none';
   e2.style.display = 'block';</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="ie"&gt;
ie
&lt;/div&gt;

&lt;div id="chrome"&gt;
chrome
&lt;/div&gt;</code></pre>
</div>
</div>
</p>