MisterXero
MisterXero

Reputation: 1128

Javascript function parameter undefined in IE

When I pass a value to my function in internet explorer 8 it keeps returning as undefined. Is there anything that would be causing this behavior I should be looking for? Thanks!

$(document).ready(function () {


    myFunction(true);

})


function myFunction(myValue){
    alert(myValue);
//IE8 displays undefined
//Other browsers display true
}

EDIT: I added a parameter to the function later on so the page I was calling seemed to be cached by IE, which called the function without setting the parameter.

I guess another question would be why is IE caching the page? I am using the jquery UI dialog to load the page that is calling the function. The script containing the function being called is loaded when the parent page is loaded.

Upvotes: 0

Views: 1371

Answers (2)

gor
gor

Reputation: 11658

I've just checked your code here - it works ok in all browsers!

Upvotes: 1

David Houde
David Houde

Reputation: 4778

I am assuming the alert is just for testing purposes, but everything looks ok. I would try:

alert(myValue?"true":"false");

Upvotes: 1

Related Questions