1

As the question suggests, is there a way to edit the styling of the drop down list of previously inputted text when typing in an input tag?

Prajeeth Emanuel
  • 647
  • 1
  • 12
  • 24
  • possible duplicate of [How can I create an editable dropdownlist in HTML?](http://stackoverflow.com/questions/264640/how-can-i-create-an-editable-dropdownlist-in-html) – Metagrapher Dec 18 '13 at 16:49
  • 1
    Any basic input tag with type="text" would display the list. Come on guys, no need to be rude. – Prajeeth Emanuel Dec 18 '13 at 16:50
  • This is not to do with a – MasNotsram Dec 18 '13 at 16:50
  • @Metagrapher It's not a duplicate. Please re-read the question. – Prajeeth Emanuel Dec 18 '13 at 16:57
  • Your question is not clear. – Metagrapher Dec 18 '13 at 17:02
  • I'll go on to say, what suggestions are you talking about? Styling of suggestions? this is not a default HTML/CSS/JS behavior. Please provide example code and be more verbose. – Metagrapher Dec 18 '13 at 17:05
  • @Metagrapher Well let me put this in layman terms. Supposing a person types his email in an input tag for facebook.com, he gets a list of dropdown suggestions of previously used emails. My question is, how do I edit this dropdown list? – Prajeeth Emanuel Dec 18 '13 at 17:06
  • Let me put this in laymen's terms: This is a code site where people talk about modifying code that they own. Are you a facebook developer? Please post the example code of what you are working on. – Metagrapher Dec 18 '13 at 17:08
  • @Metagrapher I believe this is a general question and i'm pretty sure this site is open to questions such as these too. And as for example code, please try logging out of your facebook and logging in again and see what comes up when you type in your email. – Prajeeth Emanuel Dec 18 '13 at 17:11
  • @davethecoder could you please point me in the right direction? – Prajeeth Emanuel Dec 18 '13 at 17:13
  • @Tip_Top the styling of the list – Prajeeth Emanuel Dec 18 '13 at 17:14
  • 1
    possible duplicate of [Styling autocomplete dropdowns in browsers](http://stackoverflow.com/questions/9313543/styling-autocomplete-dropdowns-in-browsers) – davethecoder Dec 18 '13 at 17:27
  • http://stackoverflow.com/questions/9313543/styling-autocomplete-dropdowns-in-browsers – davethecoder Dec 18 '13 at 17:27

1 Answers1

3

That is browser specific so no. Instead, you could build a custom system where you save the previously entered values in 'local storage' via javascript and then use an auto-complete library to display the previous entries how you like.

Some example code:

http://jsfiddle.net/R2TGL/

<input type="text" id="savedInput"/>

window.onload = function(){
 $('#savedInput').autocomplete({
    source:JSON.parse(localStorage.previousInputs)
 });

 $('#savedInput').change(function(){

    if( localStorage.previousInputs == undefined ) {
        localStorage.previousInputs = JSON.stringify([]);
    }

    var prevArray = JSON.parse(localStorage.previousInputs);
    prevArray.push($(this).val());
    localStorage.previousInputs = JSON.stringify(prevArray);

    $('#savedInput').autocomplete({
        source:JSON.parse(localStorage.previousInputs)
    });

 });
}
MasNotsram
  • 2,105
  • 18
  • 28
  • Care to comment why the downvote? I answered the question, unlike many people that didn't read it correctly, and still decided to comment. – MasNotsram Dec 18 '13 at 16:50
  • I didn't downvote, but I guess it's because you didn't provide any details, so perhaps it should just have been a comment. – Barmar Dec 18 '13 at 16:59
  • @Barmar Well that's a fair criticism, but a comment on my answer would have been more appropriate rather than a downvote. – MasNotsram Dec 18 '13 at 17:02
  • I didn't downvote, but I'd assume it's because there isn't much concrete information in your answer and it doesn't add anything to the discussion. – Metagrapher Dec 18 '13 at 17:04
  • @Metagrapher I disagree that there's not much concrete information, I stated exactly how to go about doing it, and was actually then working on expanding my answer, but came back because I was alerted that it had been downvoted. I have no problem with downvotes, I just expected a comment explanation of why the downvote was issued, so I may remedy it. It's like being sent to jail and not being told the crime. – MasNotsram Dec 18 '13 at 17:11
  • @Barmar Yeah, sorry, my answer wasn't directed at you :) – MasNotsram Dec 18 '13 at 17:15
  • Thanks for taking the time guys. I'll accept this to make up for your downvotes. – Prajeeth Emanuel Dec 18 '13 at 17:18
  • 1
    @Tip_Top Ah, thank-you for the explanation. I don't mind about the rep, no need to un-downvote, I just appreciate feedback to help me learn and answer questions most effectively. I will try to add to the answer anyway to add some value to it. – MasNotsram Dec 18 '13 at 17:18
  • @Prajeeth Emanuel Thanks Prajeeth. Did the answer help at all? – MasNotsram Dec 18 '13 at 17:19
  • @MasNotsram The autocomplete plug-in that Tip-Top pointed me to is helping me out. I've have a look at the documentation to know more – Prajeeth Emanuel Dec 18 '13 at 17:23