Tags input in CSS and javascript (No Framework)

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024
  • Link to prototype: www.kodhus.com...
    In this tutorial we are making a Tags input component purely using css and javascript

Комментарии • 52

  • @Evan-zj5mt
    @Evan-zj5mt 5 лет назад +13

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

    • @andhywilliams
      @andhywilliams 4 года назад

      I agree. Love when they start from beginning and not jump into a partially completed example.

    • @stoianmihail8480
      @stoianmihail8480 4 года назад +1

      Just hit the like button bro!

  • @ilyamuromtsev1167
    @ilyamuromtsev1167 3 года назад +1

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

  • @skydoge2907
    @skydoge2907 3 года назад +3

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

    • @mrunalvartak4479
      @mrunalvartak4479 3 года назад

      heyy this not working for me.Can you please help!!

  • @movacthuz
    @movacthuz 3 года назад +2

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

    • @insideTheDiv
      @insideTheDiv 3 года назад

      For simple tag box: ruclips.net/video/mpab1b4jvXg/видео.html

  • @whyimustusemyrealname3801
    @whyimustusemyrealname3801 3 года назад

    the best front end tutorials ever

  • @andhywilliams
    @andhywilliams 4 года назад +1

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

  • @fvgoya
    @fvgoya 5 лет назад +5

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

  • @sorrocking
    @sorrocking 5 лет назад +2

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

  • @ullylima9953
    @ullylima9953 3 года назад +1

    Thank you, excellent tutorial

  • @justamandd
    @justamandd 3 года назад

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

  • @blessdarah1256
    @blessdarah1256 5 лет назад +1

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

  • @ubermensch-mne
    @ubermensch-mne 5 лет назад +1

    Your videos deserve alot more views.

  • @Eltramicst
    @Eltramicst 2 года назад +1

    Great video and awesome tutorial topic, sir. I appreciate the attention you give to the little things, such as making sure to pronounce certain keywords with greater annunciation to avoid typos, which will naturally be followed by errors. Haha. It's pretty rare that I see that, so thank you. Keep it up, brother, and I trust that you will eventually achieve your goal (best [programming/dev] channel on RUclips).
    🙏😌

  • @rashedulislam6431
    @rashedulislam6431 4 года назад +1

    great idea

  • @yassinebowerman427
    @yassinebowerman427 5 лет назад +1

    Great video thank you so much!

  • @jonsnow3909
    @jonsnow3909 2 года назад

    Very well explained

  • @duynguyenphuong2714
    @duynguyenphuong2714 3 года назад +1

    thanks u

  • @laxmandeadpool8260
    @laxmandeadpool8260 3 года назад +1

    Thankyou buddy

  • @user-us4xy2rx2s
    @user-us4xy2rx2s 3 года назад

    Thanks, man! You are greate!

  • @vimhoangnguyen9930
    @vimhoangnguyen9930 2 года назад

    EXCELLENT!

  • @TheMsnitish
    @TheMsnitish 3 года назад

    Amazing explanation. Thanks man

  • @nurbolatnurlanuly
    @nurbolatnurlanuly 3 года назад +1

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

  • @rishiyadav3343
    @rishiyadav3343 3 года назад

    Thank you for the tutorial brother

  • @ramueller11
    @ramueller11 4 года назад +2

    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 easy peasy.

  • @quytube7316
    @quytube7316 4 года назад +1

    how to add limit tag number. please help me

  • @masumbillah4608
    @masumbillah4608 3 года назад +1

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

  • @bugidog9369
    @bugidog9369 3 года назад

    thank you! good job

  • @0xfrijolito
    @0xfrijolito 4 года назад +1

    Good tutorial bro

  • @ersatzworld
    @ersatzworld 2 года назад

    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).

  • @yolandaparawita3830
    @yolandaparawita3830 5 лет назад +1

    Thank you so much!! :))

  • @lucasser21
    @lucasser21 2 года назад

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

  • @TenAfterTen
    @TenAfterTen Год назад

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

  • @sportcity6135
    @sportcity6135 3 года назад

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

  • @justinbrown7162
    @justinbrown7162 4 года назад +1

    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?

    • @marshallchaterera2069
      @marshallchaterera2069 4 года назад

      input.addEventListener('keyup', function(e){
      // Add this statement to not print empty tags
      if(input.value != ''){
      if(e.key === 'Enter'){
      .....
      }
      }

    • @prathameshshende4
      @prathameshshende4 3 года назад

      @@marshallchaterera2069 is it possible I also insert tag with tab button like enter key

    • @marshallchaterera2069
      @marshallchaterera2069 3 года назад

      prathamesh shende yes you do:
      if(e.keyCode == 13) {
      // do something
      }

  • @Spokkkky
    @Spokkkky 3 года назад

    how will limit the number of tags and character limit

  • @user-hn5bi3nw9y
    @user-hn5bi3nw9y 2 года назад

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

  • @TheMsnitish
    @TheMsnitish 3 года назад

    Do you use OBS to record Screen ?

  • @rishiyadav3343
    @rishiyadav3343 3 года назад

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

  • @tiefsoftwarelab
    @tiefsoftwarelab 4 года назад +1

    hello.new friend

  • @nathancullen1724
    @nathancullen1724 4 года назад

    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

    • @Gabriel-cd5jx
      @Gabriel-cd5jx 4 года назад

      ** place a button with save class on the document
      function handleClick(e) {
      if (e.target.classList.contains("save")) {
      fetch("url", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({
      keywords: tags
      })
      })
      .then(response => {
      return response.json();
      })
      .then(data => {
      console.log(data);
      })
      .catch(err => {
      console.log("Error :-S", err);
      });
      }
      }

  • @god_rex579
    @god_rex579 3 года назад

    How to limit the tags to only 3

  • @Hassan-tk4hr
    @Hassan-tk4hr 4 года назад

    thxxxxxxxxxxxxxxxxxx

  • @insideTheDiv
    @insideTheDiv 3 года назад

    You can make tag box more simply: ruclips.net/video/mpab1b4jvXg/видео.html