GetElementById IE
-
19-09-2019 - |
Question
I have this:
<input type="hidden" id="aid" value="<? echo $_GET['id']; ?>"></div>
and
var aID = document.getElementById('aid'); var postFile = 'showcomments.php?id='+ aID.value; $.post(postFile, function(data){
Why will this only work in FF and not IE?
Solution
IE has issues (bugs) with keeping namespaces distinct. Do you have anything else on the page that uses "aid" as an id
, a name
, a variable at global scope, ...? If so, that's your problem. An easy way to check is to do an experiment: Change the hidden field's ID to flibberdegibbet
and change the string in your getElementById
call. If it starts working, that means you have a name conflict somewhere.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow