how to use id inside a function in java script code example Example: reference id in javascript document.getElementById("demo");