Unable to make multiple calls to single Jquery function
<p>Apologies again - this is probably down to my lack of knowledge with JQuery - but I have set up the following function whihc when passed a parameter which attempt to check for and then remove some dynamically added fields  (the check should stop the removal attempt being carried out - if not needed) </p>

<pre><code>jQuery.fn.clearFields = function ( clearField ) { 

     var clearfield_search = "#"+clearField+"_search";
     var clearfield_link   = "#"+clearField+"_link";
     var clearfield_search_label = "label[for='"+clearField+"_search']";
     var clearfield_link_label = "label[for='"+clearField+"_link']";
     alert("About to Remove");

     if ($(clearfield_search).length &gt; 0 ) { 
                                //Removal of Label and Field (Attempted) 
                                //removal of inital break &amp; labels
                                $(clearfield_search_label).prev('br').remove();
                                $(clearfield_search_label).remove();
                                $(clearfield_link_label).prev('br').remove();
                                $(clearfield_link_label).remove();
                                //Removal of fields
                                $(clearfield_link).remove();
                                $(clearfield_search).remove();
     }
     alert("Removed");
}
</code></pre>

<p>But my dilemma is I can't see to make explicit (multiple calls)  to this function -    - such as </p>

<pre><code>jQuery.fn.clearFields("ebsco");

jQuery.fn.clearfields("summon");
</code></pre>

<p>it seems only the first function call is executed - then nothing else happens - very frustrating.</p>

<p>Do I have to implement the calls using a for loop or the .each method - or I'm guessing there's something more fundamental I'm missing - or there is perhaps an even better cleaner way of doing this ?</p>

<p>Again any feedback much appreciated</p>
