Whing Dela Cruz
asked on
Html split(text) Part2
Hi experts, I wish to get the data in input text who's id="ii" and put it in a textbox separately by split via "/". I want that Whing will be put on iA, Delacruz on iB, 88 on iC, and 22 on iD. Thank you!
<!DOCTYPE html>
<html>
<body>
<input type="text" id="ii" value="Whing/Delacruz/88/22"><br/>
<button onclick="myFunction()">Try it</button><br/><br/>
<input type="text" id="iA"><br/>
<input type="text" id="iB"><br/>
<input type="text" id="iC"><br/>
<input type="text" id="iD"><br/>
<p id="demo"></p>
<script>
function myFunction() {
var str = document.getElementById("ii").value;
var res = str.replace(/\//g);
document.getElementById("iA").value = ;
document.getElementById("iB").value = ;
document.getElementById("iC").value = ;
document.getElementById("iD").value = ;
}
</script>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Monty the reference res(0), res(1), res(2), res(3) is not working here... Thanks!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Jason, Its working..
ASKER
Thank you so much both of you guys, more power and God bless you both!
ASKER