+ 1
Fix my code
I have a code named Reverse String and I don't know what is wrong, can someone please help?
3 Answers
+ 3
You need to put the code that gets the value etc inside the function also:
function change() {
var a = document.getElementById("input").value;
var string = a;
var array = string.split("");
var rarray = array.reverse();
var rstring = rarray.join("");
document.getElementById("result").innerHTML = rstring;
}
Otherwise it is retrieving the value right after the page is built and it is an empty string.
+ 1
I did that but it's still not working please help
+ 1
I just checked it and it's working for me.