views:

84

answers:

1

Hello. 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?

+3  A: 

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.

T.J. Crowder
That worked!! Thanks T.J
Karem
Excellent. Man, the time we spend on IE bugs.
T.J. Crowder
I'm afraid now that the OP has just kept the code as flibberdegibbet and declared case closed!
Mike Sherov
So was the problem that more than one element on the page had the same value for `id` -- that is, `aid` ?
artlung
Yes i believe so, even though i couldn't find any other element that had the same id (aid). But it worked.
Karem