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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:08:55+00:00 2026-05-30T23:08:55+00:00

i have an ajax for submit script on my html page, which loads a

  • 0

i have an ajax for submit script on my html page, which loads a php script with form on it….

the form only has one input for a line of comments…. this is sent via post over ajax….

however i need to create a javascript function to link from onclick in a link….

the script will be embedded in the php form page (which already has js on it)

i have around 10 different images, and i need to be able to click on each image, and it will call the function..

<a id="image_1" href="javascript: void(0);" onClick="newFunction(this.id)"> image </a>

so that the function will be called when you click the image and will transfer the variable ID to the function…..

i need the function to GET the value of the form text box,

then add the

 <a id=

to the end of the string of data that was in the text box (in this example the id would be

 'image_1'

then write the new string ( form_data_in_textbox image_1 ) to the text box….

form name + id = myform

text box name + id = comments

this could be quite simple, but im not the best at javascript…. im learning though 🙂

  • 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-30T23:08:56+00:00Added an answer on May 30, 2026 at 11:08 pm

    if I got you right, this should be:

    <script type="text/javascript">
        function newFunction(imgId){
    
            document.getElementById('comments').value = document.getElementById('comments').value + " " + imgId;
    
        }
    </script>
    
    <input id="comments" type="text" value="" size="60"/><br /><br />
    
    <a id="image_1" href="javascript: void(0);" onClick="newFunction(this.id)">image1</a>
    <a id="image_2" href="javascript: void(0);" onClick="newFunction(this.id)">image2</a>
    <a id="image_3" href="javascript: void(0);" onClick="newFunction(this.id)">image3</a>
    <a id="image_4" href="javascript: void(0);" onClick="newFunction(this.id)">image4</a>
    <a id="image_5" href="javascript: void(0);" onClick="newFunction(this.id)">image5</a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user input page which loads different forms with ajax depending on
Okay, so I have this page, which has one Ajax:AsyncFileUploader also some other ajax
I have an ajax call to one php script via jquery but it takes
I am using php/ajax to submit a form without page refresh. Here are my
I have an Ajax form that updates a div when submitted with a submit
I have a form that uses jQuery to submit an ajax post and it
I have a page with multiple forms that I submit via Ajax POSTs serially.
I need to have a checkbox which ajax-submits a form. The following code throws
I have a php function which inserts a searchbar into each page on a
I have a simple html page which renders with a number of nearly identical

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.