As discussed in this previous post
jQuery - Identify and mark link in textarea
I want to create an input box where URLs are automatically recognized, formatted and a method is called for every URL on whitespace after URL or on blur. We have a problem left though that the elem.html(newText);
used for setting the formatting p-tags around the link detected works fine, except the cursor is set to the beginning afterwards. So when you writer "this is a www.url.com" and press space, the URL is recognized and formatted correctly and the method "linkDetected" is called, but the cursor moves to the beginning of the input field, with no possibility to write on.
I created a JSFiddle so you can see the code and problem for yourself:
Any help is appreciated.