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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:11:51+00:00 2026-06-18T12:11:51+00:00

Complete novice, trying to create a personalizable Bible, where users can cycle through alternate

  • 0

Complete novice, trying to create a personalizable Bible, where users can cycle through alternate translations of individual words/phrases by clicking directly on said words/phrases. I know I probably need some sort of “for loop” in the function, but I want their preferences to be stored (as strings?) in cache and in user profile, so text should not reset to a default upon page load. Ideally I would have the alternate text options (“array”?) embedded in HTML, as below, while keeping the HTML as uncluttered as possible. JS would eventually be populated with thousands of IDs, probably several per verse of the Bible, so the more generalizable the script, the better. Thanks in advance!

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.js"></script>
<script>
$(document).ready(function() {
    $('.alternate').click(function() {
        $('#1Cor13-4a').text('[What goes here if I want to cycle through the options listed in HTML?]');
        $('#1Cor13-4b').text('[Ditto]');
    });
});
</script>

My <span class="alternate" id="1Cor13-4a" onclick="ChangeText({"care","love"})">love</span><span class="alternate" id="1Cor13-4b" onclick="ChangeText({"is patient with","suffers long for"})">is patient with</span> you.
  • 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-18T12:11:52+00:00Added an answer on June 18, 2026 at 12:11 pm

    Use the data- attributes…

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.js"></script>
    <script>
    $(document).ready(function() {
     $('.alternate').click(function() {
           var index=   $(this).attr("data-text-index");
         var text = $.parseJSON($(this).attr("data-text"));
         if(index== null)
             index = -1;
         index = Number(index)+1>=text.length? 0:Number(index)+1;
         $(this).html(text[index]);
         $(this).attr("data-text-index",index);
      });
    });
    </script>
    My <span class="alternate" id="1Cor13-4a" data-text='["care","love"]'>love</span><span class="alternate" id="1Cor13-4b" data-text='[" is patient with"," suffers long for"]'> is patient with</span> you.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my complete script... You can just create test.php and throw it in.
I'm a complete SQL novice, and I'm trying to accomplish the following (pseudo-code) with
I am trying to trigger emails with ActionMailer when users complete various actions within
I am a complete novice in C++. I am trying to read a file
Hi Im a complete novice when it coems to using JSP. Im trying to
I'm a complete HTML/CSS novice and I am trying to get a .cshtml file
I'm a complete rails rookie and i'm trying to create validation for a contact
I'm trying to use jQuery (a bit difficult because I'm a complete novice) to
having some trouble trying to figure this out, complete novice when it come to
I am a complete novice to OpenGL, so I am just trying out some

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.