Simple Java Script not working. What am i doing wrong?
-
So, I got this Javascript, which I successfully tested on w3schools.com’s editor
Name: <input type="text" id="myText" value="Mickey"> <p id='test'>Click the button to change the value of the text field.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var text = document.getElementById('myText').value; text += ' blah'; document.getElementById("myText").value = text; } </script>
However when using it on WordPress Text Editor (the one where you can edit HTML) and going back to Visual, there’s nothing changing in the textbox with id myText.
After looking it up, i saw, that WordPress removed the onclick=”myFunction() part in <button..
Why, and how can I fix this or use this code?
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Simple Java Script not working. What am i doing wrong?’ is closed to new replies.