I am trying to reference a text box and a form by id . Below is the bit of javascript code that works on Microsoft edge but will not work on Chrome. Appreciate any help.
<script type="text/javascript">
function sayHello() {
var name4 = document.form1.txthello.value; // does not work
}
<body>
<form id="form1" name="myForm1">
Name : <input type="text" id="txthello" name="myTxthello" value="" />
<br />
<input type="button" id="btnHello" value="Hello" onclick="sayHello()" />
<hr />