kneeki
kneeki

Reputation: 2692

Complete list of FontAwesome Icons for Select

I'm attempting to populate a Select Dropdown with a complete (v 4.2) list of FontAwesome Icons. The closest list I could find is here, but it's grossly out of date. Does anyone have a list they can refer me to?

Upvotes: 1

Views: 2216

Answers (1)

eithed
eithed

Reputation: 4320

This URL: http://fortawesome.github.io/Font-Awesome/icons/ contains the list of all the icons. While it's not in the format you've described, we can use some jquery to transform it to what you want:

$.map($("h2").map(function(){ 
    var a = $(this).nextAll(".row:first").find("a").map(function(){ 
        return $(this).attr('href').split("/").slice(-1)[0]; 
    }); 
    return {title: $(this).html(), options: a} 
}), function(object){ return "<optgroup label='"+object.title+"'>"+$.map($.unique(object.options), function(option){ return "<option>"+option+"</option>"; }).join("")+"</optgroup>"; }).join("");

Which generates this list: http://pastebin.com/NQ1S7RJF

(Please bear in mind that it's a list of unique icons - it won't contain, for example: file-sound-o, because it's an alias for file-audio-o)

Upvotes: 2

Related Questions