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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:55:58+00:00 2026-05-24T17:55:58+00:00

Essentially, I want to pull text within a div tag from a document on

  • 0

Essentially, I want to pull text within a div tag from a document on my server to place it in the current document. To explain the reason: I want to pull a headline from a “news article” to use it as the text for a link to that article.

For example, within the target HTML is the tag:

<div id='news-header'>Big Day in Wonderland</div>

So in my current document I want to use javascript to set the text within my anchor tags to that headline, i.e.:

<a href='index.php?link=to_page'>Big Day in Wonderland</a>

I’m having trouble figuring out how to access the non-current document in JS.

Thanks in advance for your help.

ADDED: Firefox style issue (see comment below).

  • 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-24T17:55:59+00:00Added an answer on May 24, 2026 at 5:55 pm

    Normally, I would try to solve an issue only with the tools specified by the user; but if you are using javascript, there really is no good reason not to just use jQuery.

    <a id='mylink' href='url_of_new_article' linked_div='id_of_title'></a>
    
    $(function() {
        var a = $('#mylink');
        a.load(a.attr('href') + ' #' + a.attr('linked_div'));
    });
    

    That little function up there can help you update all your link’s text dynamically. If you have more than one, you can just put it in a $('a').each() loop and call it a day.

    update to support multiple links on condition:

    $(function() {
        $('a[linked_div]').each(function() {
            var a = $(this);
            a.load(a.attr('href') + ' #' + a.attr('linked_div'));
         });
    });
    

    The selector makes sure that only the links with the existence of the attribute ‘linked_div’ will be processed.

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

Sidebar

Related Questions

I want to perform a query (to pull locations within a given distance from
I have data that I want to pull from a mySQL database and I
How do I make an entire DIV a clickable hyperlink. Meaning, I essentially want
I essentially want to spider my local site and create a list of all
Essentially I want to know if in VB.NET 2005 if using a sqlcommand and
We have a reverse proxy here, running Apache in version 2.2.x Essentially I want
Essentially what I want to do is to apply additional CSS classes to individual
If I want to essentially grep every line ever in the repository, is there
I want to write a piece of software which is essentially a regex data
Essentially, what I want to do (in DirectX) is to take two partially-transparent images

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.