title: jquery strange behaviour
body: <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><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>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>any help or suggestion so that i can achieve my goal will be highly appreciated.<br>
  Thanks in advance!!!!!</p>
  
  <p><strong>Edit--</strong></p>
  
  <p>solution given below is working fine for one call, but <code>it fails if i am calling this function again with same parameter</code> and it should be and unfortunately i have to call this function several times...how can i do this..i tried lots of thing but it fails somewhere :(:(:(<br>
  Please suggest me some approach.<br>
  Thanks Once again....</p>