Before I get started on this abnormally weird question, lemme just say that I have never heard of the following hack being applied let alone conventionally discussed with any web programmers I know, and this is merely out of curiosity in the event that I'm wrong in my hypothesis that it cannot be done.
That being said, here's my question:
Using a customized CSS based off of the latest Bootswatch version (actually using Cerulean theme), is it possible to append text between hidden p tags AND have JavaScript read the value appended properly?
Extra info: When hardcoding a value into the HTML, JavaScript has NO problem reading the value. When appending however (using #element:after for instance), JavaScript is passing a null value, I figure because the CSS loads after the JavaScript has already checked to see what value is at that particular element ID.
Example Code:
HTML
<div id="hiddenSecrets" style="display:none;">
<p id="valueOne"></p>
<p id="valueTwo"></p>
</div>
CSS
#valueOne:after { content:"2048"; }
JavaScript reads the ID "valueOne" to be null.
Any help is appreciated.
Thanks!
ADDENDUM: When debugging in Firefox using Firebug, the appended text displays in the Styles section, so the append itself works.
EDIT
Hey so, here's the answer that seems to work with my environment...
JavaScript
<script type="text/javascript">
var valueOne = document.getElementById('valueOne');
var valueOne2 = window.getComputedStyle{valueOne, ':after').getPropertyValue('content').replace(/"/g, "");
//...
</script>
However, I'm noticing now that this doesn't seem to work on mobile devices.
I'll need to validate the JavaScript that I can't post further, but at least this answers the immediate issue, if only for desktop/laptop devices.
Shoutout to @Blazemonger and @Mohamed Melouk for the help so far! :D