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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:51:58+00:00 2026-05-25T15:51:58+00:00

<div id=text>some text</div> <img src=# onclick=$.function(‘http://url.com?q=some+text’)/> I want the q= to be dynamic using

  • 0
<div id="text">some text</div>

<img src="#" onclick="$.function('http://url.com?q=some+text')"/>

I want the q= to be dynamic using the text in the previous paragraph. I can get the text into a variable

var str = $("#text").text();

but am struggling to output this dynamically.


EDIT:

It’s much simpler than I thought, figured out the solution from Darin’s answer:

  <div id="text"><p>Testing text to speech</p></div>
  <div id="textlink"></div>
  <img src="#" onclick="$.sound.play('http://translate.google.com/translate_tts?q='+ str)" />
<script>
var str = $("#text").text(); 
</script>

Just needed to know how to append a variable. Thanks

  • 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-25T15:51:59+00:00Added an answer on May 25, 2026 at 3:51 pm

    Lemme shoot in the dark:

    <img src="#" onclick="window.location.href = 'http://url.com?q=' + encodeURIComponent($('#text').text());" />
    

    or if you want to assign this src dynamically:

    <img src="#" id="foo"/>
    

    and then:

    $(function() {
        $('#foo').click(function() {
            window.location.href = 'http://url.com?q=' + encodeURIComponent($("#text").text());
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

alt text http://img190.imageshack.us/img190/7514/unbenanntax.jpg This is what I want to do. A Div with some
Here is the HTML: <div class=categories> <h3> <img src=http://i.imgur.com/TThAk.gif /> <a href=/foo>Foo</a> <p class=subtext>heading</p>
I want to align some text to the top of a div. It seems
The skeleton of the HTML is this <div class=TwoCol> <img src=imgurl/> <h1>A headline</h1> <p>Some
I'm trying to check in jQuery if a div contains some text, and then
I am loading some text dynamically into a div, but have the problem that
I have a div element containing some text. When the user clicks a word
I have some text that is stored in a variable like this: <div class=foo>text
The following jQuery example should put some text into the div, but it doesn't.
Let's say we have a box with some short paragraphs: <div style=overflow:hidden> <p>Some text</p>

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.