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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:07:28+00:00 2026-06-18T16:07:28+00:00

This is pretty much an add on to a question I posted before about

  • 0

This is pretty much an add on to a question I posted before about loading an external page without ajax, but keeping it an iOS web app window. What I came up with for that example was this

<script>
$(document).bind('pageinit', function() {
  $("#test").click(function (event) {
    event.preventDefault();
    window.location.assign("test.html");
  });
});
</script>

But now what I want to do is to set this up for every link I would have on that page. Seeing as I don’t know how many links I could have, it would be very tedious to do this every time I add a new link. So I found this snippet and thought I could combined the two some how, I just need some direction on how.

$('a').each(function(index){
var elementId=$(this). attr("id");
elementId='#'=elementId;

So for each a tag or href on my page, it will automatically grab the link and load it in that particular manner automatically.

  • 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-18T16:07:29+00:00Added an answer on June 18, 2026 at 4:07 pm

    Of course you can combine your codes. Anyway I haven’t tried your code but you have to wrap an .each() function around your click events. Also you should give every clickable link a the same class. Should look like this:

    $('.class').each(function(){
      $(this).click(function(){
        event.preventDefault();
        window.location.assign("test.html");
      })
    });
    

    if you now want those links to link on different pages you can define a data-href attribute on each link. like this: data-href="test2.html" in your html.
    You can now use

    $(this).data("href");
    

    and put the output into a variable. Afterwards you can place it in your window.location.assign thing dynamically.

    Hope I understood your problem and it helped.

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

Sidebar

Related Questions

This is pretty much a duplicate question but instead of using Castle Dynamic Proxy
This question does pretty much what I want to accomplish, but my table is
Valgrind is complaining about some of my code, but this code is pretty much
Pretty much the same as this question. But I can't seem to get this
I am pretty much sure that this question have been asked and answered several
I followed the question previously posted here I need to do pretty much same,
I realize that this question is pretty much the exact question found here .
The question pretty much says it all. I'm not sure how to do this
The question pretty much already says everything. I'm starting to add some features to
this pretty much is the thing. When in tinymce I press anything that is

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.