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

  • Home
  • SEARCH
  • 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 81733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:30:22+00:00 2026-05-10T21:30:22+00:00

I have a textbox and a link button. When I write some text, select

  • 0

I have a textbox and a link button. When I write some text, select some of it and then click the link button, the selected text from textbox must be show with a message box.

How can I do it?


When I click the submit button for the textbox below, the message box must show Lorem ipsum. Because "Lorem ipsum" is selected in the area.


If I select any text from the page and click the submit button it is working, but if I write a text to textbox and make it, it’s not. Because when I click to another space, the selection of textbox is canceled.

Now problem is that, when I select text from textbox and click any other control or space, the text, which is selected, must still be selected.

How is it to be done?

  • 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. 2026-05-10T21:30:23+00:00Added an answer on May 10, 2026 at 9:30 pm

    OK, here is the code I have:

    function ShowSelection() {   var textComponent = document.getElementById('Editor');   var selectedText;    if (textComponent.selectionStart !== undefined)   { // Standards-compliant version     var startPos = textComponent.selectionStart;     var endPos = textComponent.selectionEnd;     selectedText = textComponent.value.substring(startPos, endPos);   }   else if (document.selection !== undefined)   { // Internet Explorer version     textComponent.focus();     var sel = document.selection.createRange();     selectedText = sel.text;   }    alert("You selected: " + selectedText); } 

    The problem is, although the code I give for Internet Explorer is given on a lot of sites, I cannot make it work on my copy of Internet Explorer 6 on my current system. Perhaps it will work for you, and that’s why I give it.

    The trick you look for is probably the .focus() call to give the focus back to the textarea, so the selection is reactivated.

    I got the right result (the selection content) with the onKeyDown event:

    document.onkeydown = function (e) { ShowSelection(); } 

    So the code is correct. Again, the issue is to get the selection on click on a button… I continue to search.

    I didn’t have any success with a button drawn with a li tag, because when we click on it, Internet Explorer deselects the previous selection. The above code works with a simple input button, though…

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

Sidebar

Ask A Question

Stats

  • Questions 74k
  • Answers 74k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer In fact, CMake allow you to generate files (using configure_file… May 11, 2026 at 2:16 pm
  • added an answer ini.file ReWriteRule ^/XXXX/(.+).asp(?:\?(.*))?$ /YYYY/validate.asp?$2&url1=$1&url2=$2 [L] validate.asp 'validation step goes here..… May 11, 2026 at 2:16 pm
  • added an answer You can use the GetFullPath static method of the Path… May 11, 2026 at 2:16 pm

Related Questions

I have a form with a textbox and a button. IE is the only
I have a composite control that adds a TextBox and a Label control to
Here's the scenario: I have a textbox and a button on a web page.
I have a DropDownList and a TextBox on a Page. When the user chooses
Background I have a page on my ASP.NET MVC web app for users to
I've got a small little page that is going to be viewed from a
I have a Yes linkbutton that trigger a popup (ModalPopUpExtender) The popup contain a
I have been playing around with a search control and i have noticed that

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.