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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:52:13+00:00 2026-06-06T18:52:13+00:00

I have a form with number of submit type as images. Each image has

  • 0

I have a form with number of submit type as images. Each image has a different title. I need to find out the title of the clicked image. But my click function inside form submit is not working.

My form is:

  <form action='log.php' id='logForm' method='post' >
  <?
   for($j=1;$j<=5;$j++)
   {
    ?>
   <input type="image" src="<?=$img;?>" title="<?=$url;?> id="<?="image".$j?> class="images" />
    <?
    }
    ?>
   </form>

Jquery:

    $("#logForm").submit(function(e)
    {


  $(".advt_image").click(function(event) {
        var href=event.target.title;
    });





           var Form = { };
            Form['inputFree'] = $("#inputFree").val();
         //   if($("#freeTOS").is(":checked"))
                    Form['freeTOS'] = '1';

            $(".active").hide().removeClass('active');
            $("#paneLoading").show().addClass('active');


var url="http://"+href;

      $.post('processFree.php', Form, function(data)
            {
                    if(data == "Success")
                    {
                            $("#FreeErrors").html('').hide();
                            swapToPane('paneSuccess');

                     setTimeout( function() {  location=url }, 2500 );


                    return;




                    }

                    swapToPane('paneFree');
                    $("#FreeErrors").html(data).show();
            });

            return false;
    });

How can I get the title value of clicked image inside this $("#logForm").submit(function())?

How can I use the id of clicked image for that?

  • 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-06T18:52:17+00:00Added an answer on June 6, 2026 at 6:52 pm

    You can use event.target property

    $("#logForm").submit(function(e)
        alert($(e.target).attr('title'));
    });
    

    http://api.jquery.com/event.target/

    [UPDATE]

    I just realized it wouldn’t work. I don’t think there is a simple solution to this. You have to track the click event on the input and use it later.

    jQuery submit, how can I know what submit button was pressed?

    $(document).ready(function() {
        var target = null;
        $('#form :input[type="image"]').click(function() {
            target = this;
            alert(target);
        });
        $('#form').submit(function() {
            alert($(target).attr('title'));
        });
    });
    

    [Update 2] – .focus is not working, but .click is working
    http://jsfiddle.net/gjSJh/1/

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

Sidebar

Related Questions

I have a form with number of input type images. I need to replace
I have a form where users submit different fields to create events. The number
I have a form with phone number field, i need to validate it with
I have a form[method=get] which has a number of checkboxes all have the same
I have a form with a stage that has a dynamic number of groups
I have a form that has 8 columns and a variable number of rows
I have this code $(document).ready(function(){ // ... $('form').submit(function() { // ... $.ajax({ type: GET,
I have a simple form: function mymodule_test_form(&$form_state, $nid) { form['submit'] = array( '#type' =>
I have a form that has a section with a dynamic number of inputs,
I have a form with a number of radiobuttons where only one should be

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.