html - Changing CSS via Javascript does NOT work in IE8 for me -


I think that I'm going to switch on some eventual and eventual switch to some div tags on the code There is a small snippet on the page. This code is as follows:

  function toggleBack () {var list = document.getElementsByClassName ('innerContentForEmailCapture'); Var list2 = document.getElementsByClassName ('mpRight'); Var list3 = document.getElementsByClassName ('mpBtns'); Try {for (var i = 0; i & lt; list.length; i ++) {list.item (i) .style.display = 'none'; } (Var ii = 0; ii & lt; list2.length; ii ++) {list.item (ii) .style.display = 'block'; } (Var iii = 0; iii & lt; list3.length; iii ++) {list.item (iii) .style.display = 'block'; }} Catch (mistake) {warning (mistake); }}   

Note that this code does the exact same way, when it is called, except when working with I88 . I get an error message when using this code which states:

Type error: object does not support this property or method < / P>

I'm not sure what I'm doing wrong here. Consider class to any DIV with "InnerContentForEmailCapture" for any to turn performance and block To turn on the display and "Mpbtns"

Is there any easy way? One is to allow that behavior to work in IE8?

  document.getElementsByClassName   

This function is not supported on IE8. It would be better that you would use

  document.querySelectorAll   

So what happens to you:

  document.querySelectorAll ( '. innerContentForEmailCapture') document.querySelectorAll ( '. mpBtns') document.querySelectorAll ( '. mpRight')   

or, you can just use getElementsByClassName you Need to use polyfills

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -