Fixing javascript error in IE8 while selecting the item from autocomplete