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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:13:10+00:00 2026-05-29T06:13:10+00:00

I have several a tags as shown below on a dynamically generated page <a

  • 0

I have several a tags as shown below on a dynamically generated page

<a href='JavaScript:SWETargetGotoURL(vtUrl+"XRX+eCustomer+Account+Inventory+View", "_self")'  id='s_ViewBar' name=s_ViewBar>&nbsp;Inventory&nbsp;</a>

I need to traverse through all the a tags containing the text “SWETargetGotoURL” in their href tag and depending on the text I need to add the title tag

for example

if(extractedtext == "&nbsp;Inventory&nbsp;")
   title = "This is inventory homepage";

The a tag should finally look like this

<a href='JavaScript:SWETargetGotoURL(vtUrl+"XRX+eCustomer+Account+Inventory+View", "_self")'  title = "This is inventory homepage" id='s_ViewBar' name=s_ViewBar>&nbsp;Inventory&nbsp;</a>

I used following code to get all the tags with specific value in href tag but I am unable to get the text in between and I don’t know how to run a loop and work on all the a tags

 var screenName = $('a[href*="SWETargetGotoURL"]').attr('href');

Any help is really appreciated.

  • 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-29T06:13:11+00:00Added an answer on May 29, 2026 at 6:13 am

    I think what you’re looking for is $.each which iterates over the set of selected elements.

    $('a[href*="SWETargetGotoURL"]').each(function () {
    
        //get the text of the element
        var extractedtext = $(this).text();
    
        //check text for match
        if (extractedtext == "&nbsp;Inventory&nbsp;") {
    
            //Change title attribute of element
            $(this).attr('title', "This is inventory homepage");
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several such anchor links as shown below. <a href=http://google.com onClick=unhook()> Google </a>
I have several tags in my page that look like this: <em class=itemx item###
I have several Div tags on a page which are dynamic, i.e. depending on
I have several anchor tags in a text, Input: <a href=http://stackoverflow.com >Take me to
Let's say we have a grails web application exposing several resources. tags urls users
I have a container and inside that I have several anchor tags. These anchor
I have a repository named master which keeps product releases. It has several tags
I have several img tags inside of a hrefs that I use as buttons
I have several div tags containing simple html/css content and I need a simple
I have a large HTML file (In ASP.NET) that has several smaller ... tags

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.