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 8801553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:51:54+00:00 2026-06-14T00:51:54+00:00

I have a textbox with string, and want to check that user dropped text

  • 0

I have a textbox with string, and want to check that user dropped text between textbox string or at end of textbox string. Is there is any Javascript function to do this task? I tried createTextRange() and setSelectionRange() but nothing works.

  • 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-14T00:51:56+00:00Added an answer on June 14, 2026 at 12:51 am

    HTML

    <input type="text" id="myTextInput" value="test" />​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
    

    JS

    var myInput = document.getElementById('myTextInput');
    var defaultValue = myInput.value;
    
    myInput.addEventListener("input", function () { 
    
        var index = myInput.value.indexOf(defaultValue, 0);
        if(index == 0)
            alert('The text has been added at the end of the original string');
        else if(index == -1)
            alert('The text has been added inside the original string');
        else
            alert('The text has been added in the front of the original string');
    
    }, false);
    

    DEMO
    ​

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

Sidebar

Related Questions

Suppose I have a textbox and I want that when the user types inside
I have a text-box, and I want to enter a string in language A
I have a textbox where a user puts a string like this: hello world!
I have a textbox that i am binding to the viewmodel's string property. The
I have a string property bound to a textbox. On the same screen there
I have a textbox (I usually call it like this: document.forms[0].text.value ) that has
I have written a code that searches specific string from database table.what i want
I want to check the value of a textbox that whether it contains a
I have about 20 text fields on a form that a user can fill
I have a textbox where i want to have an autocomplete that lets the

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.