I have programmed a script– First I have created a <div>....</div> which is hidden on pageload. Then I have created an empty textbox. Now when anyone clicks a button then the whole content of the hidden <div>....</div> will be loaded in the textbox. Heres the code of it:
<div id="hiddendiv" style="display: none;">some content</div>
<button onclick="copyfunction();">click me</button>
<textarea id="textarea"></textarea>
<script>
function copyfunction() {
var textarea = document.getElementById('textarea');
var hiddendiv = document.getElementById('hiddendiv');
textarea.value = hiddendiv.innerText;
}
</script>
This JavaScript is working fine on my webpage when i am viewing it on any other browser. But when viewed in firefox, the textbox shows “undefined” as the output when the button is clicked.
Note: All Java Add-ons are enabled and up to date. Even tried clearing all cookies but it didn’t help.
There’s no
innerTextin FF, rather it’stextContent.