Suggestive Search Box [SOLVED] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Suggestive Search Box [SOLVED]

I want to return results that contain the letters in my search box / exclude results that weren't returned. I've been successful to a certain degree using the :contains function but i'm not happy . how can I return/convert the ':contains' result object as a list of strings or valid span elements (by valid i mean that i can use methods on the object like '.text()' ) https://code.sololearn.com/WG4e3B6yFX8j/?ref=app

25th Jan 2022, 1:08 AM
sonofpeter.exe
sonofpeter.exe - avatar
5 Answers
0
though i still dont know why the last two methods didn't work, i found a solution using this instead: $.each($(buff), function(index, value){ console.log(index + ": " + value.innerHTML ); });
25th Jan 2022, 8:41 AM
sonofpeter.exe
sonofpeter.exe - avatar
+ 1
May I ask why HTML datalist is not considered as an option? https://www.w3schools.com/tags/tag_datalist.asp
25th Jan 2022, 2:02 AM
Ipang
+ 1
Ipang | it's very close, but i'd like to make multiple selections before submitting eg: Ford, Mercedes Benz, Mitsubishi, etc then making it so that the spans preserve their selected state, like by adding a "selected" class, then submitting all selected classes also I'm inclined to having the nodes/options close by to click and move along quickly
25th Jan 2022, 3:02 AM
sonofpeter.exe
sonofpeter.exe - avatar
+ 1
I'm not too familiar with jQuery, so I used plain JS instead : ) https://code.sololearn.com/WixUKQ8bg5R9/?ref=app
25th Jan 2022, 9:07 AM
Ipang
+ 1
Ipang | this is brilliant . it's a little too verbose for my liking, but a great alternative . 'ppreciate it . 🤝🙂
25th Jan 2022, 9:15 AM
sonofpeter.exe
sonofpeter.exe - avatar