Create A Custom Select Menu with Search Box in HTML CSS & JavaScript

Create A Custom Select Menu with Search Box in HTML CSS & JavaScript

CodingNepal

2 года назад

92,172 Просмотров

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


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

@user-yu6ve6hz1t
@user-yu6ve6hz1t - 04.11.2023 11:40

ff

Ответить
@bubbanstix841
@bubbanstix841 - 03.11.2023 05:19

You didnt show close on blur. Actually i know but i want to see another solution.

Ответить
@matteobasso92
@matteobasso92 - 10.09.2023 11:47

Can I possible using this menu for search a image in my website gallery? Thank you

Ответить
@mauriciomendez2306
@mauriciomendez2306 - 20.08.2023 01:14

Excellent tutorial, you are a good teacher, maybe you can guide us on how to make it select with the keyboard arrows, that is, move between the options with the up and down arrows and enter to select?
greetings from Ecuador

Ответить
@rishabhkumar9604
@rishabhkumar9604 - 08.08.2023 03:00

But now i have to update code for database..how can i give name because it was an div please help

Ответить
@faizshaari5702
@faizshaari5702 - 01.06.2023 12:01

LOVE this! <3

Ответить
@farzadhashemi
@farzadhashemi - 14.04.2023 11:38

❤❤❤great

Ответить
@bennisa8102
@bennisa8102 - 16.03.2023 12:14

Can you give them a value?

Ответить
@aaaliii4u
@aaaliii4u - 16.02.2023 11:46

as always, awesome!!

Ответить
@webPro_faizan
@webPro_faizan - 14.02.2023 12:48

Add voice to your video ☺️ plz that is good but adding voice to make video better

Ответить
@redaloui
@redaloui - 14.02.2023 09:31

For The algo

Ответить
@marrisaikrishna416
@marrisaikrishna416 - 14.02.2023 04:45

Please do the videos with explanation..

Ответить
@TShatov
@TShatov - 01.02.2023 17:35

Thnx for tutorial! Very simple and clean!;)

Ответить
@alphamx13
@alphamx13 - 20.01.2023 01:14

Looks great just one question... How do you save it's value to send it on a submit form ? thank you!

Ответить
@mohsinsayyad6347
@mohsinsayyad6347 - 13.01.2023 20:54

Awesome 👌....plz make video on multiple select....

Ответить
@MikePitt-kg8xb
@MikePitt-kg8xb - 27.12.2022 15:40

Thanks for the tutorial.
I made a small change for older browsers - especially for the InternetBrowser (no startsWith())

HTML-File:
<div class="search" data-search="start"> .. new Data-Attribute

JS-File: at searchInp.addEventListener("keyup", ...
var searchWord = searchInp.value.toLowerCase();
arr = source.filter(function(data) {
var strVal = data.toLowerCase().search(searchWord);
var searchPos = searchDiv.getAttribute("data-search"); ... searchDiv = wrapper.querySelector(".search");
if(searchPos == "start") { ... Item starts with searchWord
return strVal == 0 ? true : false;
} else { ... Item contains searchWord
return strVal > -1 ? true : false;
}
}).map(function(data) {

I also set selected LI on top:
var liHeight=30; ... heigth of LI-row

function addSource(selectedCountry) {
options.innerHTML="";
var cnt=0; var sel = false;
source.forEach(function(country) {
var isSelected="";
if(sel == false) {cnt++};
if(country == selectedCountry) {
var isSelected = "selected";
sel = true;
}
var li = '<li onclick="updateName(this)" class="'+isSelected+'">'+country+'</li>';
options.insertAdjacentHTML("beforeend", li);
options.scrollTop = (cnt-1)*liHeight;
});
}
Thanks again and keep going

Ответить
@AmitDutta-dn5my
@AmitDutta-dn5my - 24.12.2022 18:41

Sir how to automatically close the dropdown when anyone clicks outside the dropdown menu, please guide me.

Ответить
@akshaybedared
@akshaybedared - 23.12.2022 17:00

Thank you!

Ответить
@ahmadfikrilalmuzakki8233
@ahmadfikrilalmuzakki8233 - 14.12.2022 09:55

bro, how to get the selected value? cause i want to insert the selected value into the database

Ответить
@amitvisw3731
@amitvisw3731 - 03.11.2022 09:19

thank u so much very helpful video sir 🥰🥰

Ответить
@danielvecino9879
@danielvecino9879 - 01.11.2022 04:29

Any way to display innerhtml once a country is selected?

Ответить
@kohlod
@kohlod - 19.10.2022 22:56

How about selects that have content that change frequently?

Ответить
@shottv3056
@shottv3056 - 16.09.2022 08:39

can you do a tutorial on how to insert the selected country to database

Ответить
@leonardocuevas4384
@leonardocuevas4384 - 14.09.2022 20:29

Nice content as always. Question: do you know how to close the dropdown menu when you click outside of it? That would be the only thing from a regular dropdown that is missing from here. Thanks.

Ответить
@tumeke4ubro
@tumeke4ubro - 16.08.2022 09:56

Great tutorial, I had looked and followed others and couldn't get them to work but this one did, thanks for taking the time out to do this for those of us who are new to JavaScript

Ответить
@tinhyeumaugi8886
@tinhyeumaugi8886 - 04.08.2022 01:57

From VietNam <3 Thankyousomuch <3

Ответить
@schanthuka5167
@schanthuka5167 - 10.07.2022 20:25

Good Job Man ..... ! Thank you Very Much....All is done Bro...

Ответить
@teraskreatif_id
@teraskreatif_id - 20.06.2022 23:20

how to use on multi select menu

Ответить
@shulehr
@shulehr - 20.06.2022 08:42

please put more trash music into the videos, its awesome

Ответить
@harshwebdeveloper
@harshwebdeveloper - 22.05.2022 18:49

amazing sir, thank you very much sir

Ответить
@teraskreatif_id
@teraskreatif_id - 22.05.2022 16:02

how to deactive select menu when click not on select menu

Ответить
@emielv8365
@emielv8365 - 02.04.2022 11:50

Respect dude, your thumbnails are extremely clean

Ответить
@elieli2570
@elieli2570 - 14.03.2022 21:40

Very useful for my learning, thanks a lot from Panama.

Ответить
@jeffreyclaybrook
@jeffreyclaybrook - 23.02.2022 18:25

Is there a specific reason for using the toLowerCase() method in the search event listener or is it just a matter of preference?

Ответить
@onlineincome5364
@onlineincome5364 - 19.02.2022 12:18

Please ptc website script video create

Ответить
@chrisl1239
@chrisl1239 - 17.02.2022 00:33

do your videos work in repl it?

Ответить
@shabankhan4383
@shabankhan4383 - 15.02.2022 21:19

Hey hi bro, thank you for the chatting App video, quite helpful. I read , understands and practice your code for 4 months. And created an app for my self. And presented to my college as a Bachelor’s project. And I got 8/8 points (100%) mark for the project, thank you soo much again. Maybe someday I’ll repay you back.
Love & respect from India

Ответить
@mhk6516
@mhk6516 - 13.02.2022 17:47

useful videos

Ответить
@FofarpShorts
@FofarpShorts - 13.02.2022 16:12

Wow Bangladesh is here i am in Bangladesh 🥰🥰🤩

Ответить
@aman_prajapati_ji
@aman_prajapati_ji - 13.02.2022 12:05

The Nepali Pro Player Is Great

Ответить
@aman_prajapati_ji
@aman_prajapati_ji - 13.02.2022 07:16

Tq so so much

Ответить
@bivawraj4428
@bivawraj4428 - 12.02.2022 17:52

Great video! Can you add, How to make this select multiple and add all selected values to select button with option to deselect / remove the wrongly selected value from list?

Ответить
@normalcoding
@normalcoding - 12.02.2022 14:17

Best Tutorial 🎉🎉

Ответить
@AbdulRahman-xl9jh
@AbdulRahman-xl9jh - 12.02.2022 09:45

Sir, your work is awesome 😘.
I want to suggest you that you have to make a little bit tutorials on table. ☺️

Ответить
@codingkhasan2482
@codingkhasan2482 - 11.02.2022 19:01

amazing code😎🤠

Ответить
@jbh1032
@jbh1032 - 11.02.2022 17:04

I really like your channel Coding Nepal...

Ответить
@Deus-lo-Vuilt
@Deus-lo-Vuilt - 08.02.2022 21:01

thanks video

Ответить