Link to home
Create AccountLog in
Avatar of Whing Dela Cruz
Whing Dela CruzFlag for Anguilla

asked on

Html split(text)

Hi experts, I wish to read the text inside input and write it on innerHTML separately by way of slash "/" that the result would something like below. Is this possible? Please help.

Whing
Delacruz
88
22

<!DOCTYPE html>
<html>
<body>

<input type="text" id="ii" value="Whing/Delacruz/88/22">
<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
    var str = document.getElementById("ii").value;
    var res = str.split...
    document.getElementById("demo").innerHTML = res;
}
</script>

</body>
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Whing Dela Cruz

ASKER

Thank you so much sir, its working!