Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to add an attribute to selected/highlighted text in a editable field?

0 Kudos
390

I have this simple editable iframe field, I can add a tag to any selected text in the field but I also want to add some attributes like target. How can I add an attribute to this editable field?

<body onload="iFrameOn();">
    <button onclick="iLink();">Add Link</button><br>
    <iframe name="RichTextField"></iframe>
   <script>
        function iFrameOn() {
            RichTextField.document.designMode = 'on';
        }

        function iLink() {
            var linkURL = 'http://google.com';
            RichTextField.document.execCommand('createLink', false, linkURL);
        }
   </script>
</body>
1 REPLY 1

lenastodal
Product and Topic Expert
Product and Topic Expert
0 Kudos
312

Hi,

Thank you for visiting SAP Community to get answers to your questions. I am here to help you to get the most out of it.

First of all, I recommend that you familiarize yourself with https://community.sap.com/resources/questions-and-answers (if you haven't done so already), as it provides tips for preparing questions that draw responses from our members.

Please also make sure you're using all appropriate tags, so the right experts can find your question. Overall, the more details you provide, the more likely it is that members will be able to assist you. Should you wish, you can revise your question by selecting Actions, then Edit (although once someone answers your question, you'll lose the ability to edit the question - but if that happens, you can leave more details in a comment).

Finally, if you're hoping to connect with readers, please consider adding a picture to your profile. Here's how you do it: https://www.youtube.com/watch?v=F5JdUbyjfMA&list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS. By personalizing your profile with a photo of you, you encourage readers to respond.

Best,
Lena (SAP Community Moderator)


Join or subscribe to SAP Community Groups to stay up-to-date, including SAP TechEd Group.