Text box already present do nothing on button click in javascript
<p>I have a button named Rename. onclick of that button one text box appears and it comes every time when rename clicked. I want the text box appear once only until we rename the file.</p>

<pre><code>$(document).ready(function(){
    $('.renameClass').click(function(){
        //if text box already present do nothing 
        // otherwise... let it rename the file
        var domparent=$(this).parent();
        renameId = $(this).attr('id');
        var filename=$(this).parent().children("p.filename");
        text=filename[0].innerText;
        fullPathName=""+renameId+filename[0].innerText;
        var dom='&lt;input type="text" class="rename" value='+text+' /&gt; &lt;button class="updateName" &gt;Done&lt;/button&gt;&lt;br&gt;';
        $(domparent).append(dom);
    });
</code></pre>