简体   繁体   中英

how to apply javascript to selected text of a textarea?

I want to apply some changes to the selected text of a text area only.

I want to select a certain portion of a text written in the text area and want to make some changes on it by javascript.

Thanks

I think the answer to this question might help you:

how-to-get-selected-text-from-textbox

It shows you selection of the text and you can use javascript to process it.

document.selection.createRange().text = "NEW TEXT";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM