How to get the selected icon from js bootsstrap iconpicker?

Viewed 1952

I installed the js bootstrap iconpicker (http://www.jqueryscript.net/other/jQuery-Based-Icon-Picker-For-Bootstrap-3-iconpicker.html, http://victor-valencia.github.io/bootstrap-iconpicker/) but I do not see how to detect the selected icon.

The example code to configure the button is:

$('#convert').iconpicker({ 
    iconset: 'fontawesome',
    icon: 'fa-key', 
    rows: 5,
    cols: 5,
    placement: 'top',
});

But there's nothing in the examples telling how to get the selected icon. I'ld think of a callback or something like that.

How can I get the selected icon?

4 Answers

the event is "iconpickerSelected"

$('#convert').iconpicker({ 
              iconset: 'fontawesome',
              icon: 'fa-key', 
              rows: 5,
              cols: 5,
              placement: 'top',
            });  
$('#convert').on('iconpickerSelected', function (e) {
 //here you can get the value

        $(this).val() 
})
Related