The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Add item to where the Cursor Text
Hi
I got a jQuery code that adds links and other stuff to a textfield. But I was wondering if I could add add stuff to where the Cursor Text is.
Is this posible and how?
Here is the code.
var $textarea = $(‘#innhold’), start = ‘‘;
value = $textarea.val(),
append_text = $(this).attr(‘value’), append_type = $(‘#class’).attr(‘value’),
space = ‘ ‘;
type = ‘” class=”‘;
if( value == ” ) space = ”;
$textarea.val(value + space + start + append_text + type + append_type + end); }); });
Thank you :D