[jQuery] .keyup + .html
[jQuery] .keyup + .html
Helloes,
I have a little thingie that clones text from an input into a div:
http://ruphus.com/code/jquery/clonetype/clonetype.html
Seems to work fine, except when I try to backspace away the entire
text in the input -- the final letter refuses to vanish from the div,
even though it's not in the input.
Any ideas what's going on here?
jQuery(document).ready(function(){
//jQuery('#source').attr('value', 'x'));
//jQuery('#clone span').html(jQuery('#source').attr('value'));
jQuery('#source').keyup(function(){
var current = jQuery('#source').attr('value');
if (current){
jQuery('#clone').html('<span>' + current + '</span>');
}
})
});
-p@