[Solved] Accessing an element using id (JavaScript)


Here is a running example:

var i = document.shipping_address;
console.log(i);
var i = window.shipping_address;
console.log(i);
var i = shipping_address;
console.log(i);
var i = document.forms.shipping_address;
console.log(i);
var i = windows.forms.shipping_address;
console.log(i);
var i = forms.shipping_address;
console.log(i);
<form id="shipping_address">
  <input type="text"/>
</form>

Also I created a JSFiddle to help you.

https://jsfiddle.net/hszknwn9/1/

please notice you have what I think is a typo in the last line:var i =

forms.shipping_address:

the : should be a ;

I corrrected it in jsFiddle

solved Accessing an element using id (JavaScript)