Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't get innerHTML of tag on IE8
    primarykey
    data
    text
    <p>I am trying to get the innerhtml of class name current_page_item[0]... And this is working fine in FF and even in IE9 also. But in IE 8 it seems to be some javascript error in line" <code>var classelem=document.getElementsByClassName('current_page_item')[0].innerHTML;</code>.</p> <p>I tried to put alert after the above line. But it is not displaying the message "Hello again".</p> <p>Any idea how to solve the browser issue for this? Is it something that <code>document.getElementsByClassName</code> wont work in IE8?</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; function updatesidebar() { alert("Hello"); var classelem=document.getElementsByClassName('current_page_item')[0].innerHTML; alert("Hello again"); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="main"&gt; &lt;div class="menu_main"&gt; &lt;ul class='mainmenu' id='root'&gt; &lt;li&gt;&lt;a href="/home" class=""&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/solutions" class=""&gt;Solutions&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="/services" class=""&gt;Services&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/about-us" class="current_page_item"&gt;About Us&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/news" class=""&gt;News and Events&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/careers" class=""&gt;Careers&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/contact-us" class=""&gt;Contact Us&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; window.onload=updatesidebar(); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload