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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:18:17+00:00 2026-05-18T11:18:17+00:00

I have a question about how to read the string betweena tag, for example.

  • 0

I have a question about how to read the string betweena tag, for example.

Devices connecting to HOME <a onclick="kmt_Toggle('BOX01', this)" class="cs_answer_link" value="[Show me how to download and install my map..]">[Show me how to download and install my map..]</a><br />
<br />
<div class="cs_answer_secondAccordion" id="BOX01" style="display: none;">
Steps for downloading and installing a map...
</div>

My code a simple, when users click on the a tag, the div class will show, and change Show me how to download and install map string in a tag to Close. When users click again, the current “close” will become “original long text”. My main issue is that How i can read the string between a tag, thanks. I can not use JQuery

  function kmt_Toggle(obj, aTag) {
  var el = document.getElementById(obj);
  if ( el.style.display != 'none' ) {
      el.style.display = 'none';
      //var tagString=document.ge(aTag).valueOf();

     // aTag.innerHTML='[more..]';
    aTag.innerHTML= tagString;
  }
  else {
      el.style.display = '';
      aTag.innerHTML='[close..]';
  }
     }

Hello Guys, thanks.

I think i have not made my question crystal clear. I want to build a toggle function in this Javascript, if people clicks on a tag, for instance,

<a onclick="kmt_Toggle('BOX01', this)" class="cs_answer_link" value="[Show me how to download and install my map..]">[Show me how to download and install my map..]</a>

It will show my div if my div has style = none; and change Show me how to download and install map into “close”

Steps for downloading and installing a map…

If people click on the link again, it will go back to the “show me how to download and installl map” and hide my div.

I tried to build something by following idealmachine solution. It does not work.

Cheers,
Qing

  • 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-18T11:18:18+00:00Added an answer on May 18, 2026 at 11:18 am

    First of all, the value attribute of an a element is not officially standardized by the W3C. You don’t need it.

    That said, some lines of code that might work are:

    // innerHTML way
    aTag.originalInnerHTML = atag.innerHTML; // to save the innerHTML
    aTag.innerHTML = '[close..]';            // to add new link text
    aTag.innerHTML = aTag.originalInnerHTML; // to restore the innerHTML
    
    
    // W3C DOM way
    // Save
    var cur = aTag.firstChild;
    aTag.oldChildNodes = [];
    while(cur) {
        aTag.oldChildNodes.push(cur);
        cur = cur.nextSibling;
    }
    
    // Add new link text
    while(aTag.lastChild) aTag.removeChild(atag.lastChild);
    aTag.appendChild(document.createTextNode('[close..]'));
    
    // Restore
    while(aTag.lastChild) aTag.removeChild(atag.lastChild);
    for(var i = 0; i < aTag.oldChildNodes.length; ++i) {
        aTag.appendChild(aTag.oldChildNodes[i]);
    }
    

    Or you could do either of these instead, similar to how you are switching the accordion sections on and off:

    • Insert both link texts into the HTML, then use CSS display: none; to switch off the one you do not want.
    • Switch between entire a elements using CSS display: none;.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Read about the issue in this stackoverflow question . Still have the same issue
I have some question about WH_MOUSE. From what I've read, by putting the hook
I have a question about the C++ visibility attribute. I have read http://gcc.gnu.org/wiki/Visibility and
I have read many question about improving the performance of C++ and C code
I have read few questions about parsing string by tags, but I didn't find
I have a question about inheritance. From this source: gSpan.h struct Edge { int
I have read many questions about Android, J2ME and RecordStore , but I still
I have read many questions about the facebook login but until not I didnt
I have read many answers to questions about dynamically resizing NSWindows and nothing has
I have question about parsing in Html helper : I have sth like: @foreach

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.