<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
function show(){
console.log(document.getElementById("abc").innerHTML);
}
window.onload=function(){
document.getElementById("xyz").setAttribute('value','5');
show();
}
</script>
</head>
<body>
<div id=abc>
<input id=xyz type=text value="2" />
</div>
<input type=button value="2" onclick="show()" />
</body>
</html>