I have a function that is used to initialize a widget.
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('<span class="ui-icon ui-icon-minusthick"></span>')
.end()
.find(component);
};
what it does is add a minus icon in the upper left corner of the widget. I have some kind of ajax call due to the fact that this function calls multiple times and adds a minus sign several times.
I am trying to rewrite this function this way, so how long it is called, add only one minus icon to the title.
I tried to approach the approach, but that didn't work.
var $minusthick = $('span.ui-icon ui-icon-minusthick');
$('div.div_header').find($minusthick).remove().prepend('<span class="ui-icon ui-icon-minusthick"></span>').end();
that I am tring removes the entire range with the class name span.ui-icon ui-icon-minusthick and finally adds a minus sign, but this did not work for me.
Edit
I call this function this way -
$('.div_portlet').initPortlet('.div_portlet','.div_header','.div_content')
$('.div_portlet_inner').initPortlet('.div_portlet_inner','.div_header_inner','.div_content_inner');
the html corresponding to this is
html:
<div class="div_portlet" id="LINEITEM_HEADER" >
<div class="div_header"><%=hu.getFrameURL(82,83)%> Line Item Header Information</div>
<div class="div_content" id="LINEITEM_HEADER_CONTENT">
</div>
</div>
html , div_portlet div_portlet_inne r, .
js.
, , .
, , , .
!!!!!