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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:36:00+00:00 2026-05-26T03:36:00+00:00

I have asked this question earlier, please click here ! this is extension to

  • 0

I have asked this question earlier, please click here!

this is extension to the question

This is my jQuery

<script>
$(document).ready(function () {
    $('#TextBox2').blur(function () {
        var objVal = $(this).val();
        if (objVal != '') {
            $('h3 a[class="Anchor2"]').text(objVal);
        }
        else {
            $('h3 a[class="Anchor2"]').text("Default Text")
        }
    });
});

My Markup

<a href="#" class="Anchor2">Default Link Text</a>
<input type="text" size="50" name="Medication2" id="Medication2">

This work fine for the first set of Anchor Link and Text Box

But in my page there is button, when click it will add more sets of Anchor link and Text Box with Unique ID

TextBox1, TextBox2, TextBox3 ....
Anchor1, Anchor2, Anchor3 ..... respectively.

How can I make my Script so work only for specific set.

Like When i have blur event for TextBox3 only Anchor 3 should get affected.

And this should be independent of each set.

  • 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-26T03:36:00+00:00Added an answer on May 26, 2026 at 3:36 am

    String manipulation:

    $(document).ready(function () {
        $('#TextBox2').blur(function () {
            // num will hold the 'number' in the id: 2
            var num = $(this).attr('id').replace("TextBox", "");
            var objVal = $(this).val();
            if (objVal != '') {
                $('h3 a[class="Anchor'+num+'"]').text(objVal);
            }
            else {
                $('h3 a[class="Anchor'+num+'"]').text("Default Text");
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I asked this question earlier. I am intrigued by std::set but I have another
I asked a similar question earlier How can I have jquery attach behavior to
I have asked this question earlier today but I didn't provide enough information and
I asked this question earlier but regarding another programming languages. Let's say I have
I asked this question earlier but I didn't express myself correctly. If I have
So earlier I asked this question: JQuery Login Redirect. Code Included The php file
I know I have asked this question in a different manner earlier today but
I asked this question a bit earlier and have only been able to gain
i have asked a similar question earlier, but this time i need a method
This question is related to my earlier question, asked here: How do I 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.