java-script single input separate into two. The first input is only 4 characters that called username and other password
<form action="a.php" method="post" id="myform" name="myform">
<label for="textfield">Prepaid Code</label>
<input type="text" name="prepaid" id="prepaid" />
<input type="hidden" name="user" id="user" value="document.getElementById('#prepaid').substring(0,4);"/>
<input type="hidden" name="pass" id="pass" value="document.getElementById('#prepaid').substring(4);"/>
<button onclick="document.getElementById("myform").submit()">SUBMIT</button>
How to make coding this by java script only