EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: MSAG on January 24, 2023, 03:05:31 PM



Title: How can i insert text in Textbox
Post by: MSAG on January 24, 2023, 03:05:31 PM
hi
How can i insert text in Textbox
in specific position


Title: Re: How can i insert text in Textbox
Post by: jarry on January 24, 2023, 06:36:13 PM
Please try to use the editeditor extension instead. Call the 'insertContent' method to insert any html content into the current cursor position.

https://www.jeasyui.com/extension/texteditor.php


Title: Re: How can i insert text in Textbox
Post by: MSAG on January 25, 2023, 01:18:37 AM
Thanks
but i dont want to use texteditor
if i use textbox not texteditor is there way to do that?

"Insert the text at the current cursor position in textbox"


Title: Re: How can i insert text in Textbox
Post by: jarry on January 27, 2023, 03:01:07 AM
This code shows how to insert a string into the current position of a textbox component.
Code:
var t = $('#tt');
var start = t.textbox('getSelectionStart');
var s = t.textbox('getText');
s = s.slice(0,start) + 'new str' + s.slice(start);
t.textbox('setText', s);


Title: Re: How can i insert text in Textbox
Post by: MSAG on January 31, 2023, 03:00:43 AM
thanks a lot :)