How do you add font awesome icons as a select list option wi


Topic: How do you add font awesome icons as a select list option with text next to it?

kylebehse pro asked 6 years ago

I need to add font awesome icons to the options of a select list (dropdown). How would one do that? Thanks!


kylebehse pro answered 6 years ago

Any one interested? I did this:
var theOptions3 = [];
$('.select option').each(function( index ) {
var theHTMLString = $( this ).data('content');
var theObject = new Object();
console.log(JSON.stringify(theObject));
theOptions3.push(theObject);
console.log( index + ": " + $( this ).data('content') );
});
$('.mdb-select ul.dropdown-content li').each(function( index ){
var theInsert = theOptions3[index].html;
$(this).find('span').html(theInsert);
});


Bartłomiej Malanowski staff pro premium commented 6 years ago

Thank you for sharing!


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.5.6
  • Device: Desktop
  • Browser: Chrome
  • OS: Mac OS
  • Provided sample code: No
  • Provided link: No