+ 6
I want to make a space remover code in javascript.
If i add a some text in textarea. Like a How are you? What is this? My name is ashi. What are you doing? My new code. Its sololearn. And after click on submit button its show me all words like this without starting space. How are you? What is this? My name is ashi. What are you doing? My new code. Its sololearn.
12 Answers
+ 13
+ 7
U can use:
SomeString.replace(/ /g, "")
to replace all space in a string
+ 7
In HTML all the white space are ignored by default. You can use <pre> tag if you want your text as it is.
+ 3
Ayesha Noor You haven't defined your onclick function yet. Submit button is useless without that.
+ 2
Aakaanksha ๐, can be written much simpler:
.replace(/^\ +/gm,"")
+ 1
Please make a example
+ 1
Akaanksha, can you plzzz make a one exapmle ?
+ 1
Thanks so much.
+ 1
Ephraim Please create a new question, not in a discussion.
And to answer your question, HTML is important because it's basically how every website works.
- 5
เคฏเคพเคฐ เคฎเฅเคเคเฅ เคฏเคนเคพเค เคเฅเค เคญเฅ เคธเคฎเค เคจเคนเฅเค เค เคฐเคนเคพ เคนเฅเฅค ๐๐๐๐๐ฃ๐ฃ๐ฃ๐ญ๐ญ๐ญ๐ญ
- 5
Nice