+ 11
I want to make a list number maker or generator,
If i add some text in textarea, like a How are you? I'm fine. What are you doing? Nothing special. And after clicking on submit Button it's show me.... like a... 01 : How are you? 02 : I'm fine. 03 : What are you doing? 04 : Nothing special. Please help me. https://code.sololearn.com/Wd8VxRHQr5hQ/?ref=app
13 Réponses
+ 4
Ayesha Noor
This might help you !
var btn=document.querySelector(".btn");
var textArea=document.querySelector(".txt");
btn.onclick=()=>{
a=textArea.value.split("\n");
text="";
index=0;
for(i of a){
if(i!=""){
text+=`0${index}:${i}\n`;
index+=1;
}
else{
text+="\n";
}
}
textArea.value=text;
}
+ 3
You have learned almost all programming Languages from sololearn and you can't even do that ??
🤨🤨
haven't you learned anything ??
And if you have learned something, then where is your attempt ??
+ 3
https://code.sololearn.com/W4AvYjcoi1hx/?ref=app
See this code
+ 2
I want a list maker code...
+ 2
Sorry , just noticed that you want the output in that format that is mentioned at last in description.
+ 2
Abhay, thanks
+ 1
I don't understand what are you looking to do with that code !
+ 1
What exactly do you mean by list maker code ? Can you please elaborate on what it should do when submit button is clicked!
+ 1
Aap Hindi Mein Baat Kar Sakte Hain?
+ 1
Read text and split to array..
var textArea = document.getElementById('textAreaId');
var lines = textArea.value.split('\n');
for (var j = 0; j < lines.length; j++) {
console.log((j +1)+ ' : ' + lines[j])
}
Hope it helps...
- 4
Hai
- 4
(Ayesha haii I like to,,,, ...)!!!