Tags input in CSS and javascript  (No Framework)

Tags input in CSS and javascript (No Framework)

FrontendTips

5 лет назад

46,319 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

RRR
RRR - 25.01.2023 10:25

Is it possible to add this script to Codepen? Your kodhus link does not work anymore?

Ответить
Jon Snow
Jon Snow - 12.08.2022 10:42

Very well explained

Ответить
donbiskit
donbiskit - 09.07.2022 10:34

Nice tutorial. Thanks. But your way to prepend tags is rather complicated. Instead of rebuilding the whole tag container you can simply use insertBefore() to insert the tag right before the tag input field. You also might consider to replace the quite complicated de- and reconstruction of the tag array by simply removing a tag with tags.splice(idx, 1).

Ответить
Махамбет Мамыров
Махамбет Мамыров - 01.06.2022 12:23

Can I use this inside the form? To use tags as input.

Ответить
Vim hoang Nguyen
Vim hoang Nguyen - 16.02.2022 05:47

EXCELLENT!

Ответить
Lucas Serral
Lucas Serral - 07.02.2022 01:47

I'd rather use innerText instead of innerHTML to assign "label" to "span" for security reasons. Excellent video though.

Ответить
Sportcity
Sportcity - 10.09.2021 19:45

Please if I don't want to input empty tag how will I do it. Please I need quick answer @frontendTips

Ответить
Laxman Deadpool
Laxman Deadpool - 08.08.2021 19:21

Thankyou buddy

Ответить
tejas .s
tejas .s - 23.06.2021 16:36

how will limit the number of tags and character limit

Ответить
ILya muromtsev
ILya muromtsev - 21.06.2021 09:18

Daym, not exavtly what I was looking for, but after some tweaks I got it working the way I need. Thanks, playboy

Ответить
rishi yadav
rishi yadav - 17.06.2021 16:08

Thank you for the tutorial brother

Ответить
rishi yadav
rishi yadav - 17.06.2021 16:08

Can we use splice() method to delete the element?

Ответить
GOD_REX
GOD_REX - 06.05.2021 19:25

How to limit the tags to only 3

Ответить
Пётр Буйницкий
Пётр Буйницкий - 30.04.2021 09:03

Thanks, man! You are greate!

Ответить
Justamandd
Justamandd - 29.04.2021 05:46

thank you!!! I've been searching this for days

Ответить
whyimustusemyrealname
whyimustusemyrealname - 29.03.2021 11:30

the best front end tutorials ever

Ответить
BugiDog
BugiDog - 18.03.2021 17:47

thank you! good job

Ответить
Nitish Chandra
Nitish Chandra - 15.02.2021 19:34

Amazing explanation. Thanks man

Ответить
Nitish Chandra
Nitish Chandra - 15.02.2021 19:23

Do you use OBS to record Screen ?

Ответить
Sky Doge
Sky Doge - 24.01.2021 12:19

Can't imagine how much work you've saved me! Legend <3

Ответить
Ully Lima
Ully Lima - 21.11.2020 02:31

Thank you, excellent tutorial

Ответить
Nurbolat Nurlanuly
Nurbolat Nurlanuly - 17.11.2020 21:00

What if someone tries to add 'css' tag two more times, so what will happen in this case when we click remove button?

Ответить
Duy Nguyễn Phương
Duy Nguyễn Phương - 02.11.2020 17:39

thanks u

Ответить
Movacthuz
Movacthuz - 20.10.2020 10:05

now this is what i'm lookin' for.. straight to the point! amazing! thanks for the help :D

Ответить
Masum Billah
Masum Billah - 16.10.2020 16:58

awesome video sir. I really surprised. Thanks for your video. sir, I want to learn advanced js. But how?

Ответить
ramueller11
ramueller11 - 15.09.2020 06:00

Nice video. I had some remarkes / suggestions - you certainly can set the attribute "class", but why not just use the direct attribute className instead of using setAtrribute('class')? Similarity, data-* attributes map to dataSet automatically. Why do you need to keep track of your tags into a seperate array - the DOM itself is an array! If you want to know the state of your tags, just call querySelector('.tags') and wham bam you got it your array. Similarily, the use of your clear() and the prepend() structures is cringe worthy and won't scale in general. All you really want to do is the Node.insertBefore() function. Finally, don't be afraid to use the "this" value when you are dealing with events, all you need is <i ... onclick="this.parentNode.removeChild(this); ..."> easy peasy.

Ответить
Quý Tube
Quý Tube - 25.08.2020 22:38

how to add limit tag number. please help me

Ответить
Hassan
Hassan - 14.08.2020 05:43

thxxxxxxxxxxxxxxxxxx

Ответить
Rashedul Islam
Rashedul Islam - 22.04.2020 10:38

great idea

Ответить
awillwill
awillwill - 10.04.2020 10:26

Great job. I'm an experienced developer a I learned quite a bit.

Ответить
0xFrijolito
0xFrijolito - 09.04.2020 07:51

Good tutorial bro

Ответить
Nathan Cullen
Nathan Cullen - 16.02.2020 15:56

Brilliant tutorial love it. Quick question though, if I wanted to use the 'tags' variable within a POST request how would I select it? Thank you

Ответить
Justin Brown
Justin Brown - 17.01.2020 22:05

Very useful tutorial, thank you! I do have a few questions b/c javascript is not my strongest skill:
1. Is it possible to prevent the enter/return key from adding empty tags?
2. How would you add a button to also add the tag?
3. Is it possible to have tags listed alphabetically?

Ответить
Pluto Design
Pluto Design - 18.11.2019 15:15

fuck u and thank

Ответить
Yolanda Parawita
Yolanda Parawita - 26.08.2019 16:36

Thank you so much!! :))

Ответить
yassine bowerman
yassine bowerman - 07.08.2019 17:05

Great video thank you so much!

Ответить
Evan
Evan - 14.05.2019 11:39

One of the best tutorials I've ever seen. Surprising that there are so few views.

Ответить
sorrocking
sorrocking - 16.04.2019 00:00

It's a great tutorial! Very simple and clean. Waiting a new videos.

Ответить
Omar Adžagić
Omar Adžagić - 14.03.2019 22:12

Your videos deserve alot more views.

Ответить
bless darah
bless darah - 14.01.2019 22:33

This tutorial is very handy you know... Great!

Ответить
Fernando Goya
Fernando Goya - 14.01.2019 02:29

I’m glad you made this tutorial!!! Thanks man!!!!

Ответить