When the element is created the click is fired

When the element is created the click is fired

When the system exec this code, the event click is fired.
What's going wrong?

  1.     $("#box-btn").html("");
  2.     $("<a>").prependTo("#box-btn")
  3.     .attr("href", "#page3")
  4.     .attr("id", "final")
  5.     .attr("data-theme", "a")
  6.     .attr("data-transition", "flip")
  7.     .attr("data-role", "button")
  8.     .html("Final");

  9.     $("#page2").page("destroy").page();