bootstrap-iconpicker
bootstrap-iconpicker copied to clipboard
Reset Iconpicker
How is it possible to reset the Icon picker? I want to set during the runtime another icon.
I see it's possible with: .iconpicker('setIcon', 'fa-wifi')
The problem here is the icon picker doesn't shows the selected icon page.
I've done several trials to reset it via:
1.) .iconpicker('reset')
2.) Initialize via JS and clear content before:
$('#editCategoryIcon').empty().iconpicker({
align: 'left',
footer: false,
icon: icon,
iconset: 'fontawesome',
rows: 5,
search: true,
searchText: 'Suchen...'
});
But I can't figure it out, any ideas?
Something like this fiddle using a clone ?
$('#my_checkbox').on('change', function(){
if ($(this).is(':checked')) {
$('#my_iconpicker').iconpicker();
} else {
var source = $('#my_iconpicker');
source.unbind().empty();
var clone = source.clone(false);
source.remove();
$('label').before(clone);
}
});
$('#setIcon').on('click', function(){
$('#my_iconpicker').iconpicker('setIcon', 'fa-wifi')
})
Solution is to clear the value (val)... $('.notify_icon').val('').iconpicker('setIcon', notify_icon);
I just got some simply reset option here
$('#iconpicker').iconpicker()
$('#iconpicker').iconpicker('setIcon', 'empty')