开发者

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..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜