onfocus, type, outfocus, count, deactive after time period
<p>I would like to have such a jQuery when a user can click in a text input box, where they type it appears in 'real-time' in a div [this part, I have no problem with] - however, I would like to offer the user to outfocus from the text input box for upto, say, 5 seconds. If the user re-onfocus they can continue writing and it appears 'real-time', otherwise if more than 5 seconds later, the 'realtime' function disappears (but can continue writing).</p>

<p>When the realtime function disappears - I would like an edit button to appear next to the div where they can edit it in the div. I guess a hidden input would be required.</p>

<p>I guess what I'm looking for is similar to how Wordpress allows you to write in a page title, where the title forms part of the URL.</p>

<p>For the realtime part, I know I could do the following (not sure though on the logic and time counting once the focus has been lost):</p>

<pre><code>$('#entry').keyup(function(){
    // if &lt; 5 sec
    var entry = $('#entry').val();
    $('#display').html(entry+'&lt;input type="button" id="edit" value="Edit"&gt;');
    $('#hidden-display').val(entry); // hidden input

    // if &gt; 5 sec
    // do nothing realtime; add edit button
    $('#display').html($('#hidden-display').val()+'&lt;input type="button" id="edit" value="Edit"&gt;');
});
</code></pre>

<p>Then for editing:</p>

<pre><code>$("#edit").click(function(){
    $('#display').html('&lt;input type="text" id="update" name="update" value="'+$('#hidden-display').val()+'"&gt;&lt;input type="button" id="save" value="Save"&gt;&lt;input type="button" id="cancel" value="Cancel"&gt;')
});
$("#cancel").click(function(){
    $('#display').text($('#hidden-display').val());
});
$("#save").click(function(){
    var entry = $('#update').val();
    $('#display').html(entry+'&lt;input type="button" id="edit" value="Edit"&gt;');
    $('#hidden-display').text(entry);
});
</code></pre>

<p>I know the above isn't quite right, as should be adding in some <code>live</code> parts, the part i'm struggling with is the outfocus count, then checking that when back in focus.</p>

<p>Any help would be appreciated, any solution would be highly welcomed - especially if far more efficient than my current working draft :)</p>
