EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: crosemffet on January 20, 2016, 11:08:09 AM



Title: add icon to panel dynamically
Post by: crosemffet on January 20, 2016, 11:08:09 AM
hello and thanks in advance for your support.
I have on panel, with certain icons defined.
example:

data-options:tools:'#tt'
        <div id="tt">
            <a href="javascript:void(0)" class="icon-add" onclick="javascript:alert('add')"></a>
            <a href="javascript:void(0)" class="icon-edit" onclick="javascript:alert('edit')"></a>
            <a href="javascript:void(0)" class="icon-cut" onclick="javascript:alert('cut')"></a>
        </div>

on certain events, I want to add / remove icons from the panel's header.
example, I want to add
<a href="javascript:void(0)" class="icon-help" onclick="javascript:alert('help')"></a>
how can I make it?
thanks you in advance.


Title: Re: add icon to panel dynamically
Post by: jarry on January 20, 2016, 11:20:23 PM
Please try this:
Code:
var tool = $('#p').panel('header').find('.panel-tool');
tool.prepend('<a href="javascript:void(0)" class="icon-help"></a>');  // add an icon
tool.find('a.icon-edit').remove();  // remove an icon