Friday, 6 September 2013

wiered javascript result in my code undefiend variable

wiered javascript result in my code undefiend variable

$(document).ready(function () {
var cache = new Array();
$("#selectOne").change(function () {
var val = $(this).val();
if (cache[val] == null) {
// do something
}
});
});
the if line is giving me that error :
Error: TypeError: cache[val] is undefined
can anyone tell me why this error is raised ?

No comments:

Post a Comment