Похожие чаты

Hello guys! Please help) The task is There are 3 inputs. Output

in textarea the contents of all input fields separated by commas. Use setinterval. (When entering data in the input - they are displayed in the textarea)

The problems is
1. When I just click on the field, 3 commas is appearing, but every comma should appear only after entered text.

2. How to do that the last comma after value didn't appear?

Thank you!

16 ответов

23 просмотра
Anna-Anna Автор вопроса

like if (inputs[i].value != "") { text += inputs[i].value + ', '; }

Hitmare Chelien
like if (inputs[i].value != "") { text += inputs...

If you want to show only on input they why using setinterval just add oninput or onchange event Then just add condition like this one

Anna-Anna Автор вопроса
Anna Anna
Thank you a lot!!!☺️

but Pranav has a point. instead using an interval you could update the big textfield by using onipnput or onchange that way you could eliminate the last comma with ease as well

Anna-Anna Автор вопроса
Hitmare Chelien
but Pranav has a point. instead using an interval ...

I'm still only at the beginning, so here task without events yet. Therefore emulated by setInterval.

Anna-Anna Автор вопроса
Hitmare Chelien
but Pranav has a point. instead using an interval ...

Or I didn't get something?)🤔 About that last comma decided to ask a teacher, maybe let it be there, in case of adding more fields, for example)))😁 Than will not touch it)))

Anna-Anna Автор вопроса
Hitmare Chelien
but Pranav has a point. instead using an interval ...

There should be no comma after the last one. Omg)))😱

Anna Anna
There should be no comma after the last one. Omg))...

thats what i tought ^^' you could to a i'd say rather quick and dirty solution and change if (inputs[i].value != "") { text += inputs[i].value + ', '; } to if (inputs[i].value != "") { text += inputs[i].value; if (inputs.length < i) { text += ', '; } }

Anna Anna
screenshot

can you make a screenshot like this again ?

Anna Anna
screenshot

Array.from(inputs, x => x.value).filter(Boolean).join(', ');

Anna-Anna Автор вопроса
Anna-Anna Автор вопроса
Anna Anna
I'm still only at the beginning, so here task with...

This is a terrible way to teach 🤦‍♂️

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта