+ 1

How do i fix this code

I am making a code that removes everything but letters but it keeps saying cannot change value of undefined here is the link https://code.sololearn.com/WcMDZonBHspS/?ref=app

7th Aug 2017, 12:23 AM
FloweyTheCoder
2 Answers
+ 1
Your html file is fine except you're missing the l at the beginning of the word letters for the button. The javascript below should help you to figure it out: function Function() { var p = document.getElementById("id"); var txt = p.innerHTML.slice(8); // .slice(8) removes the "x equals " from the beginning so all that is left is what the user input. var regex = /[^a-z]/gi; txt = txt.replace(regex, ""); p.innerHTML = txt; }
7th Aug 2017, 1:27 AM
ChaoticDawg
ChaoticDawg - avatar
0
thanks
7th Aug 2017, 3:37 PM
FloweyTheCoder