Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7933129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:14:03+00:00 2026-06-03T21:14:03+00:00

I have an Ajax HTML editor and a Dropdown above it. On choosing an

  • 0

I have an Ajax HTML editor and a Dropdown above it.
On choosing an item form the Dropdown I want the Text of the selected item in the Dropdown to get pasted at the current cursor position in the AJAX HTML editor.
Any ideas..?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:14:04+00:00Added an answer on June 3, 2026 at 9:14 pm

    Yeah at the end of the Third day I finally got a solution for my problem, posting it here so that someone can save there precious time from re-inventing the wheel.

    This is my Ajax ATML Editor:

    <Ajax:Editor ID="EdtrHTML" runat="server" />
    

    I want the selected text from the dropdown to be pasted at the current cursor position in the HTML editor,so I’m calling the function to insert text(InsertAtCursor) on the “change” event of the dropdown.

    As a parameter to the function InsertAtCursor i’m passing the ID of the IFrame which gets created while rendering HTML editor.

     $(document).ready(function () {
                $('#<%:DropDownID.ClientID%>').change(function () {
                var ddltext = $('#<%:DropDownID.ClientID%> option:selected').text();
                var ddltext = ' [' + ddltext + '] '
                InsertAtCursor(idofHTMLEditorIFrame, ddltext);//Function for Insertion
            });
        });
    

    This is the function which inserts Text from the dropdown at the cursor position of Ajax HTML Editor.

     function InsertAtCursor(myField, myValue) {
    
            if (document.selection) {
                myField.focus();
                sel = document.selection.createRange();
                sel.text = myValue;
            }
    
            else if (myField.selectionStart == 0 || myField.selectionStart == '0') {
                var startPos = myField.selectionStart;
                var endPos = myField.selectionEnd;
                myField.value = myField.value.substring(0, startPos) + myValue +
                            myField.value.substring(endPos, myField.value.length);
            }
            else {
                 myField.value += myValue;
            }
        } 
    

    In my case my Ajax Editor was inside an Update panel and so after a partial post back the script stopped working, and i found help here.

    Hope this works for you too…Cheers..!!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form + layout like so: <form ...> <div id=editor> [form html]
I have a AJAX request that will return a string that contains some HTML
Working on an AJAX website (HTML,CSS,JavaScript, AJAX, PHP, MySQL). I have multiple javascript functions
I have a div that is created by Ajax with .append(html) function, I'm trying
I have an HTML page that uses AJAX to retrieve messages from a server.
I have the following HTML structure being returned from an AJAX request... <th scope=col
I have an HTML (App) file that reads another HTML (data) file via jQuery.ajax()
I have the following HTML structure: $('#subgroup a').nextUntil('h3').wrapAll('<div></div>'); <script src=https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js></script> <div id=subgroup> <h3>Group name
I have this code, $('.editLayout #changeLayout').click(function() { $('html').height($(document).height()); $('#fluidWrap').hide('scale'); $.ajax({ data: { mainLayout: true
I have ajax code for asp.net (non-mvc) to call to a webMethod to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.