jQuery ignores .replace() after first usage
<p>the following lines of code are supposed to take whatever i type in and replace " " with "-" which works on the first space, but no space thereafter.</p>

<pre><code>$('#myinput').live('keypress', function() {  
    var value = $(this).val();  
    value = value.replace(" ", "-");  
    $('#mydiv').text(value);  
});
</code></pre>
