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

  • Home
  • SEARCH
  • 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 8341755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:34:46+00:00 2026-06-09T05:34:46+00:00

OK so this may be a little complex so bear with me. I have

  • 0

OK so this may be a little complex so bear with me.

I have a block of HTML with several hidden fields in it that have coordinates:

    <div id="content">
<div class="event">
    Blah blah blah
    <input id="e1coords" class="coords" name="e1coords" type="hidden" value="-27.482359,153.024725" />
</div>

<div class="event">
    blah blah blah
    <input id="e2coords" class="coords" name="e2coords" type="hidden" value="-27.471134,153.0182" />
</div>
<div class="event">
    blah blah blah
    <input id="e3coords" class="coords" name="e3coords" type="hidden" value="-27.471667,153.023704" />
</div>
    </div>

I have some code thats supposed to take the value from each hidden input (coordinates) and transfer it into part of the href url. EG:

   //GET COORDS
            $(content).find('.coords').each(function() {
                var coords = $(this).val();

                //CREATE BUTTON, ADD VALUE FROM
                var input2 = '<div class="inputholder"><a class="viewmap" href="maptest.html?longlat='+ coords +' "><button>Find on Map</button></a></div>';
                //ATTACH BUTTON
                $(input2).insertAfter($('#showday1 .save_event'));
            });  

This works OK to a point. It creates a button for each input (so in the example above 3 buttons are created) but dislpays them 3 times each. So from the HTML above I get 9 buttons where there should be 3.

Can any one suggest a way to display the button just once per hidden input?

  • 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-06-09T05:34:48+00:00Added an answer on June 9, 2026 at 5:34 am

    If you want your generated buttons to be placed right after each hidden input HTML field (based on your input) I’d go like:

    $(document).ready(function() {
               $(content).find('.coords').each(function() { 
                    var coords = $(this).val(); 
                    var input2 = '<div class="inputholder"><a class="viewmap" href="maptest.html?longlat='+ coords +' "><button>Find on Map</button></a></div>'; 
                    $(this).after(input2);
                });   
    });
    

    As you have already detected the inputs (with class coords) the after jQuery function should append the desired content right after each of the hidden inputs


    On the other hand if you just want all the buttons to be placed on the end of the div with id=content:

    $(document).ready(function() {
               var input2="";
               $(content).find('.coords').each(function() { 
                    var coords = $(this).val(); 
                    input2 += '<div class="inputholder"><a class="viewmap" href="maptest.html?longlat='+ coords +' "><button>Find on Map</button></a></div>'; 
                }); 
                $(content).after(input2);
    });
    

    In this approach we aggregated all of the generated inputs (for each hidden input) and in the end we appended them to the wrapper div

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

Sidebar

Related Questions

This may be a little subjective, but I have often found that it can
This may be a little hard to describe since I don't have a sample.
This question may seem a little bit stackoverflow-implementation specific, but I have seen a
So this may be a little tricky, but take a look at the div
Ok this may sound a little weird but what i have is a frameset
I realize something like this has been asked, but this may be a little
This need may sound a little convoluted, and if so, then I am open
This problem may be a little broad, but I'm going to go ahead and
This may be a stupid question but I have a code with the following
This may be have a better name than custom tab completion, but here's the

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.