Facing weird problem while adding and removing class
<p><br>
 i have below function which is being used to initialize a widget.  </p>

<pre><code>jQuery.fn.initPortlet = function( parent_component ,header , component ){
        var o = $(this[0])
        this.addClass("ui-widget ui-widget-content ui-corner-all")
            .find(header)           
            .addClass("headertitle")
            .addClass("align_center")
            .addClass("defaultheadercolor")
            .prepend('&lt;span class="ui-icon ui-icon-minusthick"&gt;&lt;/span&gt;')
            .end()
            .find(component);
};
</code></pre>

<p>what it does is append a minus icon at the top left corner of the widget.
i have some ajax call because of that this function get called multiple time and append a minus icon multiple times.</p>

<p>i am tring to re-write this function in such a way, so that how many time it's get called, append only one minus icon into header.<br>
i tried fallowing approach but it didn't work.  </p>

<pre><code>var $minusthick = $('span.ui-icon ui-icon-minusthick');
$('div.div_header').find($minusthick).remove().prepend('&lt;span class="ui-icon ui-icon-minusthick"&gt;&lt;/span&gt;').end();
</code></pre>

<p>what i am tring is remove all span with class name span.ui-icon ui-icon-minusthick and finally append a minus icon, but it's not worked for me.  </p>

<p><strong>Edit</strong>
i am calling this function in this way-</p>

<pre><code>$('.div_portlet').initPortlet('.div_portlet','.div_header','.div_content')   
            $('.div_portlet_inner').initPortlet('.div_portlet_inner','.div_header_inner','.div_content_inner');
</code></pre>

<p>html corresponding to this is- </p>

<p><strong>html:</strong>  </p>

<pre><code>&lt;div class="div_portlet" id="LINEITEM_HEADER" &gt;
&lt;div class="div_header"&gt;&lt;%=hu.getFrameURL(82,83)%&gt; Line Item Header Information&lt;/div&gt;
            &lt;div class="div_content" id="LINEITEM_HEADER_CONTENT"&gt;

            &lt;/div&gt;  
&lt;/div&gt;
</code></pre>

<p>for second call html will remain  same just classes will get change from <code>div_portlet</code> to <code>div_portlet_inne</code>r, in the same way for other class.
i have written this function in a js file.</p>

<p>any help or suggestion so that i can achieve my goal will be highly appreciated. 
Please guys help me out i got stuck at this point.
Thanks in advance!!!!!</p>
