Edit in JSFiddle

function $id(id) {
  if ($id.cache[id] === undefined) {
    $id.cache[id] = document.getElementById(id) || false;
  }
  return $id.cache[id];
}
$id.cache = {};

// Test
console.log($id("idTest").innerHTML);
<html>
<body>
  <div id="idTest">
  $id() will be used to log the contents of this div to the console. Check the console.
  </div>
</body>
</html>
body {
  font-family: arial;
}