live wrapping words from a input field(jQuery)
Looking for a way to wrap words that have been enterd in a text field. Words that have been seperated by a space should be wrapped and displayed below the text field(like tags).
I cant find a tutorial on the web.so a开发者_StackOverflownybody here any ideas how to do this?
$('input').observe('keyup', function(){
$('tags').update($('input').value.replace(/\s/g, '<br/>'));
});
Working demo: http://jsfiddle.net/SkYpg/
Note: The demo has been done with Prototype rather than jQuery, since I'm more familiar with that. It should be easy to convert, though..
精彩评论