I am trying to fetch the value from text input in HTML to a variable in javascript. An uncaught type error had appeared. The following are my HTML code:
<form name="purchaseform" id="formma">
KJW M700 <br>
<input name='buyM700' type='text' id='1234'>
<input name='caller' type='button' value='click here' onClick='call()'>
</form>
The following are my Javascript code:
var m700 = document.purchaseform.buyM700.value;
function call() {
confirm (m700);
};
Thank you for helping me in advance.