document.getelementbyid( result ).value = b in javascript code example Example: javascript get element by id var myElement=document.getElementById("someElementID");