facebook style jquery tokeninput script retains value in the jquery-ui modal window
<p>trying to use facebook style <a href="http://loopj.com/jquery-tokeninput/" rel="nofollow">tokeninput</a> script which I'll use in the same way as FB uses(using <a href="http://jqueryui.com" rel="nofollow">jquery-ui</a> to get the modal window) to send messages to friends in a social networking system.</p>

<p>Clicking on the 'open the dialog' button ('opener' id makes the modal window appear)</p>

<p>javascript snippet:</p>

<pre><code>    &lt;script type="text/javascript"&gt;
    $(document).ready(function() {
        $("input[type=button]").click(function () {
            alert("Would submit: " + $(this).siblings("input[type=text]").val());
        });
    });

&lt;/script&gt;

    &lt;script type="text/javascript"&gt;

    $(document).ready(function() {



             $(".show_dialog script").remove();
         $dialog = $('.show_dialog');


         $dialog.dialog({
                width:500,
                height:300,
                autoOpen: false,
                title: 'Basic Dialog'
            });

        $('#opener').click(function() {
            $dialog.dialog('open');

            $(this).siblings("input[type=text]").val('this is a value ')// ADDED BY ME 


            //$("#demo-input-facebook-theme", $dialog).val('');





            $(".border_text", $dialog).css("border","1px solid red");
            // prevent the default action, e.g., following a link
            return false;
        });
    });
    &lt;/script&gt;
</code></pre>

<p>html snippet is :</p>

<pre><code>&lt;button id="opener"&gt;Open the dialog&lt;/button&gt;


&lt;div class="show_dialog" style="display:block ;"&gt;


               &lt;label class="send_meg_recipient_txt"&gt;To:&lt;/label&gt;







&lt;h2 id="theme"&gt;Facebook Theme&lt;/h2&gt;
    &lt;div&gt;
        &lt;input type="text" id="demo-input-facebook-theme" name="blah2" " /&gt;&lt;br&gt;&lt;/br&gt;
        &lt;input type="button" value="Submit" /&gt;


        &lt;script type="text/javascript"&gt;
        var script = jQuery('&lt;script/&gt;').attr('src', 'js/jquery.tokeninput.js').appendTo('head');

        $(document).ready(function() {


        var script = jQuery('&lt;script/&gt;').attr('src', 'js/jquery.tokeninput.js').appendTo('head');


        var q_string=$("#demo-input-facebook-theme").val();





            $("#demo-input-facebook-theme",$dialog).tokenInput("token_find/my3.php?q=q_string", {

                preventDuplicates: true,
                theme:"facebook"

            });


        /*
        */  

        });


        &lt;/script&gt;


    &lt;/div&gt;


 &lt;/div&gt;&lt;!--end of class  show_dialog--&gt;
</code></pre>

<p>I can get the tokenizing from the script.
But after tokenizing for once if i click on the 'opener' id, the modal window appears with its previous tokens retained in place, which I obviously don't want.</p>

<p>How to get rid of it?</p>
