Quick Autocomplete App With JS & JSON

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

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

  • @TraversyMedia
    @TraversyMedia  5 лет назад +83

    JS starts around 6:40 if you want to skip the HTML....thanks for watching!

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

      At work on Friday I did this the long way and outdated way following that WC3 Tutorial. I will change my code to something like this because this is more modern and easy to understand I could have done it this way but I just had to get something up and running. Thanks Brad. You are doing the Lord's work.

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

      Hey man, thanks to you I am on my way to starting a career in a field of interest. Is there anyway one can contact you, maybe like Discord or something?
      You are an absolute blessing to us who are self-taught.

    • @joelmason6818
      @joelmason6818 5 лет назад

      You ought to recreate this in a bit more complicated way and create a rudimentary state method to explain how state is handled in higher level apps such as react. It would be an interesting lesson for beginners.

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

      Make youtube series course on vuejs and d3js for data visualization . Love from Nepal

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

      Next time use material theme inside vscode so it will be pleasing to the viewers eyes, the default theme looks ugly.

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

    I just spent a full weekend looking up the best way to do this and this is the simplest solution i've seen so far. THANK GOD WE HAVE BRAD

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

    I will name my first son after you, this saved my ass so badly, I haven't worked with fetch api in such a long time. I had no clue where to even begin to do this typeahead search from a local Json.
    Had to adapt some of the code since I use TS and Angular but you are truly a lifesaver.

  • @gopinathkrm58
    @gopinathkrm58 5 лет назад +32

    Thanks Brad...All your videos are very very good and helpful. And please do a video on SEO Brad...that would be nice.

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

      brad , in one of his video already told that he really dont know how all this SEO works so maybe he will not make a video on something in which he is not an expert.

  • @TraversyMedia
    @TraversyMedia  5 лет назад +37

    Someone pointed out that I am making a request with every input event fire. Here is some revised code...
    const search = document.getElementById('search');
    const matchList = document.getElementById('match-list');
    let states;
    // Get states
    const getStates = async () => {
    const res = await fetch('../data/states.json');
    states = await res.json();
    };
    // FIlter states
    const searchStates = searchText => {
    // Get matches to current text input
    let matches = states.filter(state => {
    const regex = new RegExp(`^${searchText}`, 'gi');
    return state.name.match(regex) || state.abbr.match(regex);
    });
    // Clear when input or matches are empty
    if (searchText.length === 0) {
    matches = [];
    matchList.innerHTML = '';
    }
    outputHtml(matches);
    };
    // Show results in HTML
    const outputHtml = matches => {
    if (matches.length > 0) {
    const html = matches
    .map(
    match => `
    ${match.name} (${match.abbr})
    ${match.capital}
    Lat: ${match.lat} / Long: ${match.long}
    `
    )
    .join('');
    matchList.innerHTML = html;
    }
    };
    window.addEventListener('DOMContentLoaded', getStates);
    search.addEventListener('input', () => searchStates(search.value));

    • @AndreiStroescu
      @AndreiStroescu 5 лет назад

      this revised js actually solved my "TypeError: res.json is not a function" bug that persisted from minute 4 till the end of this tutorial from the line:
      const states = await res.json();

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

      i have error on this line - const states = await res.json(); -
      on res.json ();
      Chrome Compiler says " Uncaught (in promise) SyntaxError: Unexpected end of JSON input at searchStates "

    • @andriiauziak1178
      @andriiauziak1178 5 лет назад

      @@upload8722 this is happening because fetch() fires up from index.htlml instead of main.js for some strange reason. Just delete from fetch request: "../" or put .html and .js files in same folder, this worked for me.

    • @omerayhan7751
      @omerayhan7751 5 лет назад

      this one actually quite better if you think about performance

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

      Hi Brad, I'm having problem at the final state of this project, the browser is throwing an error message saying Uncaught TypeError: Cannot set property 'innerHTML' of null
      at outputHtml (main.js:40)
      at searchStates (main.js:25)
      at HTMLInputElement. (main.js:45)

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

    This is one channel that i dont even wait to watch the video before liking... You are awesome traverse

  • @mmughal
    @mmughal 5 лет назад +14

    Thanks Brad! Because of your mern stack course I got first place in a local Bootcamp , thanks !!

  • @waruidenis-fxtrader8479
    @waruidenis-fxtrader8479 4 года назад

    Its 2020 and you're still impressing me with your old time knowledge. Genius! Kudos from Kenya Africa. I'll apply this to my new real life project and share it with you in a few days it should be up and running. Thanks again.

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

    Brad Traversy is a machine himself. Thanks for yet another super video. You are an inspiration to many upcoming developers.

  • @LD-gp5hm
    @LD-gp5hm 5 лет назад

    I had this for an interview. Brad is the best!!!!!!!!!

  • @andriiauziak1178
    @andriiauziak1178 5 лет назад +12

    For those who have an error while fetching data:
    Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
    This is happening because fetch() fires up from index.htlml instead of main.js . Just delete from fetch request: "../" or put .html and .js files in same folder, this worked for me.
    If we will look at Brad's Live Server URL we would see that index.html have no parent folder, so fetch can't execute request: "../".It can't go level up to parent directory because its don't exist on port 5501 in this case, so it works just OK in this video. My localhost look like this: 127.0.0.1:5500/JS/Autocomplition/index.html and it get error while fetching data from states.js, because fetch have place to go while executing this part of path: "../".

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

      Thank very much. This help me with this tut and prior tut. Cheers!

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

      Cheers mate!

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

      dude thanks a lot

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

      This!!

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

    Great video , I’m watching this from 16000 km from the US.

  • @DavidMSSmith
    @DavidMSSmith 4 года назад +4

    This is a great! I just wish it included a function to select the state so that you could complete the search. Afterall, we must assume that once they search they'll want to go to a page or resource.

  • @w3althambition265
    @w3althambition265 5 лет назад +37

    Hey Brad, you can actually use emmet in js. You just need to add this setting in your vs code setting.json
    "emmet.includeLanguages": {
    "javascript": "html"
    },

    • @TheMadHaxor
      @TheMadHaxor 5 лет назад

      Literally about to google that issue, cheers my dude

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

      Thaks thats very useful

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

    Wow I just started learning about Fetch API and Async/Await stuff.
    Brad is always on point with the trend.

  • @julian.castro18
    @julian.castro18 4 года назад

    This was awesome! I googled and found a json file with the provinces of my country and I was able to follow and adapt the code in this tutorial very easily. You've convinced me to learn Bootstrap, at first I was skeptical but it's obviously a very powerful tool.

  • @millisstudio5267
    @millisstudio5267 5 лет назад

    Hi Brad , I was create project by this tutorial, tried think about every code parts and was search many information about methods on MDN and how these work behind the scene)
    Thanks for u job man, it's really cool because when I'm watching your tutors, I'm learning how think algorithmically.
    I was change some stuff, now not states but polish voivodeships)

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

    Thanks a lot, this tutorial appeared very useful for me. I've made a suggestion engine on Python with FastAPI that sends out suggestions to requests containing a prefix. So I wanted to make a decent web UI for this thing, and following this video I've managed to do it. Instead of fetching data from a JSON file I send a prefix to my script and it returns a JSON reply. The rest of the code is basically the same. This video is awesome and explained very clear, even for a Python-based guy who's not too familiar with JS

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

    Thank you so much , been trying all day with examples and no real tutorial other than yours. You explained everything really good, cheers mate.

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

    I can't believe, what fantastic content Brad is uploading!
    If you read this, thank you very much!
    The very best wishes from Vienna :-)

  • @911madza
    @911madza 5 лет назад +23

    nice use of async/await, regex and template literals ;)

    • @TraversyMedia
      @TraversyMedia  5 лет назад +4

      Yeah It's a very small project but I figured I would use a very modern syntax in a real situation to help others grasp

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

      @@TraversyMedia I've also watched your full length Async JS and ES6 vids, so it was nice to see stuff applied in practice :)

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

    I noticed that matchList inerHTML does not reset when matches array is/gets empty. So, you should add this if statement in the searchStates function:
    if (matches.length === 0) {
    matchList.innerHTML = '';
    }
    this will clear the innerHTML in case the input does not match with the regex.

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

      I tried it his way and your way and when I remove any search text, it still doesn't clear the matchList.innerHTML for me. However, if I clear it manually via the console, it works. Any ideas?

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

    I always learn something. I liked the map with the html + join. Definitely adding that to the toolbox.

  • @84PatSch
    @84PatSch 3 года назад

    a very useful video, thank you buddy
    short information for other users: If you want to search for only ONE keyword like "name" or "abb" or anything else, you also can use the html-tag : Load the json file with js > great a DOM with all the keyword options in your html document > choose your certain keyword option in the input tag by "keydown actions" or by the "button down arrow" in the right of the input > create a new "addEventListener() method" for the "key-enter" or "mouse-klick" action after the input is filled or one element of the list is selected > create a new DOM object like a or with all the json data of the selected keyword option. The is a very easy and useful html tag for a seach bar function ...

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

    For those who have an error while fetching data:
    Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
    You just need to take out the "../" from fetch() method.
    You can use like this: fetch('data/states.json');
    This works here.

  • @thomasjohnson3628
    @thomasjohnson3628 5 лет назад +45

    I vote up before I even watch it because it's Brad!

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

    Brad. I know it's a long time ago, but this video just saved my life. I got the basics from your fantastic udemy course on Javascript, but this was just the example I wanted.. Thanks again

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

    In my opinion, it is the best guide on youtube)

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

    I did not know you could use an array to write html ! :O Nice method! Thanks Brad!

  • @dwburger
    @dwburger 5 лет назад

    This is an excellent tutorial and has helped me build a search app for plants (instead of states). I'm trying to extend it just a bit by allowing the user to select which keyword in the json data to search on. For example, my json data has names like "Name", "Cultivar" and "Reference" each with their own values. I'd like to allow the user to select any of those json names (Name, Cultivar or Reference) on which to match. Here's the relevant code as it stands:
    const search = document.getElementById('search');
    const matchList = document.getElementById('match-list');
    let plants;
    // Get plants
    const getPlants = async () => {
    const res = await fetch('data/plants.json');
    plants = await res.json();
    };
    // Filter plants
    const searchPlants = searchText => {
    // Get matches to current text input
    let matches = plants.filter(plant => {
    const regex = new RegExp(`^${searchText}`, 'gi');
    return plant.Name.match(regex);
    });
    As you can see, the search only uses "Name" for the matching. I'd like that to be variable based on user input (Name, Cultivar or Reference). Could anyone suggest how to do this or point me to an online reference that explains how to do this. Thanks!

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

    You are so awesome! Brad.
    thank you for all of your videos.

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

    I don't understand very well English but you are awesome, your videos are amazing and I love them. I could understand async/await with this video and I'm very grateful with you. I would wish had to know your channel 1 or 2 years ago jaja. Thanks!

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

    Love this small projcet!!!
    Please do them often!

  • @kevinzhang8974
    @kevinzhang8974 5 лет назад

    Thanks Brad again. very neat and useful weekend project. I like it so much ... perfect for Friday/Sat to commit 1 hr to do it while still able to take care of kids and family stuff.

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

    Hi Brad... I just wanna thank you for courses... I learn so much evryday... God Bless !!!

  • @NikhilAdiga
    @NikhilAdiga 5 лет назад +20

    Liking before watching the video because it's Brad!

    • @mel-182
      @mel-182 5 лет назад +2

      saved to my playlist before watching bcuz its brad.

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

      Downloaded before watching, because it's brad😅

    • @HolyGhostGymer
      @HolyGhostGymer 5 лет назад

      so you haven't seen it yet... too slow bruv

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

    Dude you cant imagine how good you are at explaining and showing things ;D im writting currently my bachelor thesis with typescript and after that I want to learn more about web development and in my TODO playlists are nearly all your videos.

  • @MyReviews_karkan
    @MyReviews_karkan 5 лет назад

    That went over my head, but I still liked it. Gotta dive into some complicated stuff to get better. One thing only, I'd have loved for you to slow down a little bit and explain things with a bit more details. Unless, this is aimed intermediate/advanced people, then I understand.

  • @Behold-the-Florist
    @Behold-the-Florist 3 года назад

    There's no one like you Brad! :D

  • @sebastianmelbye5403
    @sebastianmelbye5403 5 лет назад +3

    Thank you for this brad. Love this little short projects(love the long one as well, dont get me wrong), where we can burst out a little app in just a half an hour, to brush up on the skills we need or learning something new. Cheers from Norway!

    • @TraversyMedia
      @TraversyMedia  5 лет назад +3

      That is exactly why I create them. They're also fun for me :)

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

    Be honest, Im watching this completely new to this, trying to learn. This is another video for people who are at your level, not for people actually trying to learn.

  • @oop_web7707
    @oop_web7707 5 лет назад

    You're a good teacher.Thanks Brad

  • @sixtusushahemba9419
    @sixtusushahemba9419 2 года назад +2

    MR Brad you've done it again. To be honest all your content are always great, I mean really great and helpful, they also relates to real world projects. Thanks so much for this amazing project. I personally created my own project which I actually included the search engine but didn't know where to find a tutorial project related to what and how I actually want the search engine to function like. Until I found one from you today. I'm curious sir, incase I want the data from the JSON file/package to be specifically customized to my need, how do I do that please. Looking forward for your response sir!

  • @iamlisaross
    @iamlisaross 5 лет назад

    So short simple and useful. Great nuggets here right through. I wish I'd had this when I was getting started.

  • @giorgimerabishvili8194
    @giorgimerabishvili8194 5 лет назад

    Brad is truly a legend!

  • @reggiebdog
    @reggiebdog 5 лет назад

    You make it look so easy. Great job... again

  • @manugalaxy14
    @manugalaxy14 5 лет назад

    Yo Brad, no idea if somebody already pointed this out, but at the end of the video you mention to clear the innerHTML if the searchText is empty. A better solution for this would be to add an else statement to if (matches.length > 0) which makes sure that if the matches is an empty array the innerHTML is set to null.
    The code would be like follows:
    if (matches.length > 0) {
    const html = matches.map(match => `

    ${match.name} (${match.abbr}) ${match.capital}
    Lat: ${match.lat} / Long: ${match.long}

    `).join('');
    matchList.innerHTML = html;
    } else {
    matchList.innerHTML = null;
    }
    Great video as always anyway.

    • @rishikeshp.5610
      @rishikeshp.5610 5 лет назад +1

      This is much more effective than what Brad did as it also makes sure that if the expression doesn't match then 'matchList' would disappear.
      For example, with Brad's code, if I type 'Del', then Delaware pops up but if I continue with 'Delhi', then the Delaware card still remains.
      Brad forgot to address that.

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

    great work by educating people, the code make sense as you describe it but could you create "part2" with refactoring? There are few parts that set up bad habbits:
    #1 as the states.json data is still the same (and usualy is in autocomplete), you should load it once instead of every keystroke. Extra request for each key is not a good idea.
    #2 "fail-fast" - if there is no input, you dont need to execute the filter loop (and save up some time), you can check for the length at the start and simply call outputHtml([]);
    #3 prepare regular expression outside of the filter loop. Now you are preparing new regex for each iteration while you can set it up before loop once.
    #4 as separation of concerns, clearing up the match-list should still be done in outputHtml function instead of extra condition in searchStates. In here, simple else case will do it. (this is first step for the separation, there are more candidates like preparing html vs altering dom)
    optional #5 introduce debounce/throtle functionality to limit number of operation for keystrokes
    keep up the good work!

  • @dakshkriplani2935
    @dakshkriplani2935 5 месяцев назад

    done and dusted thanks man you are a legend

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

    Great video as always Brad but you can have (matchList.innerHTML = "";) in the else part of the outputHTML function instead of the searchText.length if condition for better functionality.

  • @cubemania6240
    @cubemania6240 5 лет назад

    Like your crash courses.thanks Brad

  • @froggore52
    @froggore52 5 лет назад +10

    Would it be more performant to do the api fetch once, and then have the "input" event merely do the filtering? Your code fires a new ajax request on every single keystroke. Or maybe that's the preferred method? I dunno.

    • @TraversyMedia
      @TraversyMedia  5 лет назад +3

      Yes, you are correct. I guess I was just trying to make it as easy as possible. But check the pinned comment for the revised code.

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

      Traversy Media hey brad, I have a error like ReferenceError: document is not defined
      how can I fix it

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

      @@TraversyMedia hey Brad! thanks for the awesome tutorial. As Chris said I'm having an issue due to that. Could you direct me to the revised code? Thanks!

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

      @@TraversyMedia Any chance we could get that revised code? I'm trying to leverage this for filtering through an entire iTunes library, and it's very slow when it makes the request on every keystroke. I'm not sure of the best way to research this to get the solution I'm looking for.

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

      @Traversy media plzzz provide the revised code i cant find it

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

    Thank you Brad...This is truly awesome

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

    This is one of the coolest project

  • @matteobarbieri2989
    @matteobarbieri2989 5 лет назад

    Great. It's important to remind us what you can do without any framework. Thanks

  • @arch7143
    @arch7143 5 лет назад

    Oh that map.join chaining stuff is freak-noice.

  • @joaovitordefrancisco7444
    @joaovitordefrancisco7444 5 лет назад

    MAN, YOU ARE AWESOME!
    Thank you so much, I've been using jquery autocomplete, but now i can do vanilla JS Baby!
    One more tool for using in my dev days.
    Thanks Bro!

  • @GilAguilar
    @GilAguilar 5 лет назад

    Thanks for some much in depth and refreshing videos they motivate me to stay on top of things cheers Brad.

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

      you prolly dont give a damn but does anybody know a method to get back into an instagram account??
      I was dumb forgot my password. I would love any tricks you can give me

  • @AdrianGonzalezBlogs
    @AdrianGonzalezBlogs 5 лет назад

    Awesome video, it's great you used pure javascript!

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

    Just looking for it Brad 😀😀
    Thank you man

  • @Chandasouk
    @Chandasouk 5 лет назад

    Cool stuff, Brad. I implemented this feature at my job but using Elasticsearch to generate the autocomplete suggestions.

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

    wow!! no hablo ingles pero me ayudo muchisimo, muchs gracias por estos videos

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

    Thank you so much, Brad. Very informative!

  • @ClassicCartoonsNL
    @ClassicCartoonsNL 5 лет назад

    Nice work, Brad!

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

    ill watch before my breakfast !!!im in san francisco just yr video woke me up :)

  • @chamodnimsara7054
    @chamodnimsara7054 5 лет назад

    Simple and Elegant as always! Good stuff Brad.. and please do a SEO tutorial .. Regards from Sri Lanka

  • @pybest9932
    @pybest9932 5 лет назад

    love from Algeria ..thanks Brad

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

    Thanks, Brad for the great video.
    Question - what would be the best practice if the array or object of items is really massive? For example, if we want to use for autocomplete all cities of t world. I assume fetching whole such JSON would significantly hog the local memory.
    Is there any way around it in terms of performance or is it better to load from the database in such a case?

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

      Trying to do the same Mate, did you figure out yet?

  • @this.channel
    @this.channel 5 лет назад

    Hi Brad, you've been doing this for a while now and I think you are pretty good, although I'm not qualified to judge. If you don't mind me asking, do you feel you are constantly improving, or do you just get to a guru level and kind of peak around there? If you are constantly improving, what have you learned recently? What do you think you still need to improve on?
    I ask because sometimes I think I'm generally doing good, but then I pick up a platform like Magento, and realize I'm missing something that is making it really hard to learn. It would be good to intuitively know the weaknesses or areas I need to work on. Thanks.

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

    Hi, great solution and well explained. One question though is what about the approach to selecting one of the options from the presented list?

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

    you can do this more optimal.
    now you fetch all data evety time when key press regards what you type. if you have milion records this may be veery slow.
    second you fetch all data and then if value is empty you clear result. you better stop fetch data in that situation.
    or for example you can fetch all data on start and then only filter it in thath event.
    besides that very nice video 🤗

    • @degraphe8824
      @degraphe8824 5 лет назад

      You are actually right though...fetching it all the time maybe inefficient. But Im guessing he knew that. The major point I believe was that fetching a local jsom file with fetch api is very possible. That for me is enough to give this video a resounding A+ ...
      Thanks Brad for everything

    • @rene78
      @rene78 5 лет назад

      @@degraphe8824 I would have saved the states in a separate .js file (first line of that file would be "let states=...here comes the JSON data) and then use this variable in my main js file. Thus all the fetch stuff can be omitted.
      Of course the newly created js file has to be linked in the html just like the main.js

  • @vladimirjean
    @vladimirjean 5 лет назад

    Like always great video Brad, thanks a lot!

  • @shubhrajit2117
    @shubhrajit2117 2 месяца назад

    Now this is possible natively with

  • @giorgimerabishvili8194
    @giorgimerabishvili8194 5 лет назад

    Great video Brad! BTW aren't you going to make some Angular videos in the nearest future?

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

    thanks bro i love your tutorials

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

    Thanks Brad.

  • @christinenichols8637
    @christinenichols8637 5 лет назад

    What a fun little project!

  • @utkarshtripathi2349
    @utkarshtripathi2349 5 лет назад

    I'm always being motivated by you, Thank you for providing that much useful content, sir.

  • @danielsousa9
    @danielsousa9 5 лет назад

    Thank you Brad. You're amazing.

  • @danielaparicio3692
    @danielaparicio3692 5 лет назад +4

    0:00 - 0:05 BEST 5 SECONDS

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

    Thanks! Today I've learned a new thing. ❤️

    • @letok2871
      @letok2871 5 лет назад

      Me too, i had never seen output html through map operator))

  • @djmilen4o
    @djmilen4o 5 лет назад

    This approach seems very like React. I like it though. Clean and simple!

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

    Thanks for the great work.
    Selecting the suggesion and showing it in the text box is not in the code. Can you please include it.?

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

    @Brad @Traversy Media This is a great tutorial! I have a great use case for it. However, there is one piece missing... once you select a state, how do you get one of the items in the filtered list to populate into an html table???

  • @feranmiafrica9528
    @feranmiafrica9528 5 лет назад

    I have never watched any Brad's video and not learn something new

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

    I think the video is very good and easy to understand. The data is fetched and filtered, but how do I get an entry in the input field from the list? I would like to continue working with the data! A note or an addition to it would be very, very helpful. Thank you for your effort and the video! Thumbs up!

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

      How do I make those results clickable and direct to a page ?

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

    Great explanations! thanks!

  • @bankoleesan2129
    @bankoleesan2129 5 лет назад

    My Hero... Thank you Brad ^-^

  • @YashGupta-dr5re
    @YashGupta-dr5re 5 лет назад

    Great video!
    Would love to see some Object Oriented JavaScript projects! :)

    • @utopictown
      @utopictown 5 лет назад

      He made it already try search older vids of his

  • @rahulg8
    @rahulg8 5 лет назад

    Hey Brad, Please make some videos explaining SEO. It would be very helpful for freelancers like us.

  • @naturegoggle
    @naturegoggle 5 лет назад

    Awesome. More please

  • @RedVelocityTV
    @RedVelocityTV 5 лет назад

    Another great tut Brad, can you do a simple tutorial to convert js code/library into react compatible code using refs? I've looked it up a lot but nothing exists and the official doc is a bit too much to consume for a newbie like me 😩😩

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

    Thank you for the tutorial. But İ have a question. Let's suppose that we have 50 thousand cities in that JSON file. Isn't that gonna be time consuming to await fetching all of them? Is there a way to deal with my problem?

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

    Hello, thank you for the video !

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

    Thanks man, you are awesome!

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

    Thank you so much, it helped a lot, however Can you mention , how can I SELECT a line by clicking any results? to return that selected line's data back ? thanks (yeah I'm beginner lol)

  • @saileshpatra2488
    @saileshpatra2488 5 лет назад

    Are you planning for a react-native udemy course? With the same project that you have done in your MERN stack course?

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

    Thanks the most optimal solution!
    Question: Now how can i select any option and put it on the input?

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

      i hope someone can assist us on this in vanilla js as I am also looking at how to put my selection into the input field and at the same time, if I delete a letter after selection and tab away the deleted letter must be restored in the input
      e.g. when I search for and select "colorado", if I delete the "o" and the "r" for example but then tab or click away, the input selection must always restore to its original selected word "colorado"

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

    This is a great example. Can you show how to insert a link to the selection in the HTML?

  • @upload8722
    @upload8722 5 лет назад +3

    i have error on this line - const states = await res.json(); -
    on res.json ();
    Chrome Compiler says " Uncaught (in promise) SyntaxError: Unexpected end of JSON input at searchStates "

    • @alexcauble3710
      @alexcauble3710 5 лет назад

      I'm getting this same issue any thoughts?

    • @adibhasib
      @adibhasib 5 лет назад

      Make sure your JSON file is ok. The error says that your json file has syntax error

    • @upload8722
      @upload8722 5 лет назад

      Thanks , I consume 2+ Hour for this error but i am always check main.js file.

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

      Work on Firefox but Failed to to Load Fetch API Error on Chrome.