micc83 / fontIconPicker

🌈 jQuery fontIconPicker v2 is a small (3.22kb gzipped) jQuery plugin which allows you to include a simple icon picker with search and pagination inside your administration forms.
http://micc83.github.io/fontIconPicker/
MIT License
266 stars 87 forks source link

After load success,how do I select an icon by default? #29

Closed HyramTang closed 7 years ago

HyramTang commented 7 years ago

After loading the page, how do I select an icon by default? the default icon come from database.

micc83 commented 7 years ago

Not sure what are you asking for. In order to set a default icon you would proceed as you would with any other regular input field:

<select id="myselect" name="myselect" class="myselect">
    <option value="">No icon</option>
    <option>...</option>
    <option selected>icon-search</option>
    <option>...</option>
</select>

or

<input type="text" name="mytext" id="mytext" value="icon-search" />

or if you need to do it on the fly:

var $picker = $('#e1_element').fontIconPicker();
$picker.val('icon-search').refreshPicker();

Hope that helps.

Cheers, Alex

HyramTang commented 7 years ago

I used font-awesome icon can't run,can you support font-awesome icon?:smile:

micc83 commented 7 years ago

Fontello uses Font Awesome v4.7.0.