title: closing and opening jquery popUps add multiple buttons
body: <p>Using a Jquery popUp iv added a help icon beside the 'X' button on the title bar. Problem being when I close the popUp and open it again there are 2 help icons, close and open, there are 3...and so on....</p>
  
  <p>I can set display to none, which removes it, but the next time the popUp is opened there are 2 hand icons...tried:</p>
  
  <pre><code>    &lt;script&gt;
      $('#helpIconBtn').removeClass(".ui-dialog-titlebar");
      $('.helpIconBtn').removeClass(".ui-dialog-titlebar");
      $('#iconhelp').removeClass(".ui-dialog-titlebar");
      $('#iconhelp').removeClass(".helpIconBtn");
      // $('#iconhelp').css('display', 'none');
      //$(".iconhelp").removeClass
       //  $(".iconhelp").classList.remove(".ui-dialog-titlebar");
       $("iconhelp").removeClass("helpIconBtn");
       $("iconhelp").removeClass(".ui-dialog-titlebar");
      &lt;/script&gt;
  </code></pre>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>var floater_style_feature_panel_popup = $("#floater_Style_Features_Panel_popup");
  
  
                  floater_style_feature_panel_popup.dialog({
                      resizable: false
                  },
                      { width: "auto" },
                      { height: "auto" },
                       { position: { my: "top+45", at: "bottom", of: $("header")} },
                      { show: { effect: "slideDown"} },
                      {dialogClass: "helpIconBtn"},
                      { hide: true },
                      { open: function (event, ui) {
                          floater_style_feature_panel_popup[0].parentNode.classList.add("opaqueDialog");
  
                          ResizeStylerDialog();
                      }
                      },
                      { beforeClose: function (event, ui) {
  
                          if (closeFeatureStyler == false) {
                              var funcParamCall = { "funcParam": [{ "funcName": "OnFeatureStylePreClose()"}] };
  
                              $$("FeatureStyler")[0].contentWindow.postMessage(JSON.stringify(funcParamCall), "*");
                              alert("false");
                              return false;
                          }
                          else {
                              alert("true");
                              //$('#iconhelp').removeClass(".ui-dialog-titlebar");
                              //$('#helpIconBtn').removeClass(".ui-dialog-titlebar");
                              //$('.helpIconBtn').removeClass(".ui-dialog-titlebar");
                             // $('#iconhelp').removeClass(".helpIconBtn");
                              // $('#iconhelp').css('display', 'none');
                              // $('#iconhelp').css('display', 'none');
                              // $(".iconhelp").classList.remove(".ui-dialog-titlebar");
                              //$("iconhelp").removeClass("helpIconBtn");
                              //$("iconhelp").removeClass(".ui-dialog-titlebar");
                              return true;
                          }
                      }
                      },
                      { closeOnEscape: true
                      }).parent().appendTo("form:first");
  
                  $(".helpIconBtn").children(".ui-dialog-titlebar").append("&lt;span id='iconhelp' class='ui-icon ui-icon-help'&gt;&lt;/span&gt;");
  
                  $("#iconhelp").click(function () {
                     alert('help');
  
                  });
  
  
  #iconhelp{
      cursor: pointer;
      float: right;
      margin-right:15px;
      margin-top: 1px;
      background-color: #EEEEEE;
      width: 18px;
      height: 20px;
      border-radius:4px;
  }
  </code></pre>