Dynamically constructing a FlipSwitch in jQuery mobile

Dynamically constructing a FlipSwitch in jQuery mobile

I'm looking for a way to build a new FlipSwitch control inside a container:  <div id="container"/>

If I run  $("#container").flipswitch({ onText:"Stay", offText:"Go"});  the HTML that gets generated is:

<div class="ui-flipswitch ui-shadow-inset ui-bar-inherit ui-corner-all"> <a class="ui-flipswitch-on ui-btn ui-shadow ui-btn-inherit" href="#"/> <span class="ui-flipswitch-off"/> <div class="ui-flipswitch-input" id="container" tabindex="-1"/> </div>

which doesn't contain my onText/offText labels and also spills out of my container div.

Do I need to manually create the  input  or  select  HTML element inside my container or is there a better way to do this?

Follow-up: I get an error when calling the destroy method according to the API:

jquery.mobile-1.4.5.js:9408 Uncaught TypeError: undefined is not a functionmessage: "undefined is not a function"stack: (...)get stack: function () { [native code] }set stack: function () { [native code] }__proto__: Error

Is this a known issue?