Skip to main content
typo
Source Link
Heretic Monkey
  • 12.1k
  • 5
  • 49
  • 70

Okay, here's something weird, the following snippet works fine in Chrome 51 on Windows 8.1:

Array.prototype.slice.call(document.getElementsByTagName('p')).forEach((item) => item.style.display = 'none''block');
p {
  display: none
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p>abc</p>

Or at least, it did when I copied the OP's snippet into this question and edited it. Now, whether it works later is anyone's guess... [still works after posting].

Note that I don't call any jQuery code, just replicate in plain JavaScript/DOM.

Okay, here's something weird, the following snippet works fine in Chrome 51 on Windows 8.1:

Array.prototype.slice.call(document.getElementsByTagName('p')).forEach((item) => item.style.display = 'none');
p {
  display: none
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p>abc</p>

Or at least, it did when I copied the OP's snippet into this question and edited it. Now, whether it works later is anyone's guess... [still works after posting].

Note that I don't call any jQuery code, just replicate in plain JavaScript/DOM.

Okay, here's something weird, the following snippet works fine in Chrome 51 on Windows 8.1:

Array.prototype.slice.call(document.getElementsByTagName('p')).forEach((item) => item.style.display = 'block');
p {
  display: none
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p>abc</p>

Or at least, it did when I copied the OP's snippet into this question and edited it. Now, whether it works later is anyone's guess... [still works after posting].

Note that I don't call any jQuery code, just replicate in plain JavaScript/DOM.

Source Link
Heretic Monkey
  • 12.1k
  • 5
  • 49
  • 70

Okay, here's something weird, the following snippet works fine in Chrome 51 on Windows 8.1:

Array.prototype.slice.call(document.getElementsByTagName('p')).forEach((item) => item.style.display = 'none');
p {
  display: none
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p>abc</p>

Or at least, it did when I copied the OP's snippet into this question and edited it. Now, whether it works later is anyone's guess... [still works after posting].

Note that I don't call any jQuery code, just replicate in plain JavaScript/DOM.