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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:40:38+00:00 2026-05-28T20:40:38+00:00

I am dynamically generating textboxes in ASP page and suppose they are calling javascript

  • 0

I am dynamically generating textboxes in ASP page and suppose they are calling javascript function “foo” on text change. I want to pass the textbox ID calling the function to that javascript function.

i.e. If you are typing in textbox 3, I wanna show that Currently You are typing in txtbox3 (the id of textbox 3)

I have an autocomplete function I dont know how to pass the ID of the calling textbox.. I am using class attribute but it changes the value of every textbox… I want the ID instead of .tbi

  • 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-05-28T20:40:39+00:00Added an answer on May 28, 2026 at 8:40 pm

    There are a couple answers depend upon how your code works.

    If you are attaching the event handler with addEventListener, then you can get the object that generated the event from the this pointer like this:

    obj.addEventListener("change", function() {
        // get the id of the object that triggered the event
        var id = this.id;
        // do whatever you want to with that id
    }, false)
    

    or using a regular function:

    function foo(e) {
        // get the id of the object that triggered the event
        var id = this.id;
        // do whatever you want to with that id
    }
    
    obj.addEventListener("change", foo, false);
    

    or, if you are embedding the event handler directly in the HTML, you can do it like this:

    <textarea id="xxx" onchange="foo(this)"></textarea>
    
    function foo(obj) {
        // get the id of the object that triggered the event
        var id = obj.id;
        // do whatever you want to with that id
    }
    

    As is usually the case on stackoverflow, if you show us your actual HTML and javascript, you will get answers specific to your particular situation.

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

Sidebar

Related Questions

I am dynamically generating a div and want to change its content via html()/text(),
i'm generating controls dynamically on my asp.net page by xslt transformation from an xml
I have a page that is currently generating dynamically created textboxes in a table
I'm dynamically generating image from text, and existing image on my asp.net website. Here
i'm dynamically generating asp controls inside an update panel on a certain trigger. However,
I'm generating buttons dynamically that I want it to call a method like this:
I am generating a .png image that contains a text dynamically written. I need
I'm dynamically generating radio buttons in my code behind and assigning javascript to them
I am dynamically generating controls, and sometimes I want to create a control and
I am dynamically generating a function and assigning it to a class. This is

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.