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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:00:53+00:00 2026-05-25T01:00:53+00:00

jQuery simple modification to disable clicking The following jQuery make use of an image

  • 0

jQuery simple modification to disable clicking

The following jQuery make use of an image submit button of a the JqPostForm form to post.

How to change the image from image1.png to image3.png when clicked and disable further clicking ? and how to remove the Thank you message after 2 sec ?

There is no need of keeping the form.

<script>
$(function(){
    $("#JqPostForm").submit(function(e){
       e.preventDefault();   

        $.post("add.php",
        function(data){

                $("#message_post").html("Thank you");

        });
    });

$('#submit').hover(
            function(){ // Change the input image's source when we "roll on"
                $(this).attr({ src : 'image2.png'});
            },
            function(){ // Change the input image's source back to the default on "roll off"
                $(this).attr({ src : 'image1.png'});             }
        );

});
</script>

<form id="JqPostForm">

<input type="image" name="submit" id="submit" src="image1.png">

</form>
<div id="message_post"></div>
  • 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-25T01:00:54+00:00Added an answer on May 25, 2026 at 1:00 am
    1. Use $(this).unbind('click').attr('disabled', 'disabled'); on the submit button to disable it.
    2. Use setTimeout(function () { $("#message_post").hide(); }, 2000); to hide the message after 2 seconds.

      <script>
      $(function(){
        $("#JqPostForm").submit(function(e){
         e.preventDefault();   
      
          $.post("add.php",
          function(data){
      
                  $("#message_post").html("Thank you");
                  setTimeout(function () { $("#message_post").hide(); }, 2000);
          });
      });
      
      $('#submit').hover(
              function(){ // Change the input image's source when we "roll on"
                  $(this).attr({ src : 'image2.png'});
              },
              function(){ // Change the input image's source back to the default on "roll off"
                  $(this).attr({ src : 'image1.png'}).unbind('click').attr('disabled', 'disabled');
           }
          );
      
      });
      </script>
      
      <form id="JqPostForm">
      
      <input type="image" name="submit" id="submit" src="image1.png">
      
      </form>
      <div id="message_post"></div>
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found a tutorial on css tricks to make a simple accordion. http://css-tricks.com/snippets/jquery/simple-jquery-accordion/ I
The following simple jQuery function works perfectly on Mozilla Firefox(5.0) but doesn't work on
Following is the simple jQuery function but I couldn't figure it out. <html> <head>
I found a tutorial on making the following slide down panel. http://www.webdesignerwall.com/demo/jquery/simple-slide-panel.html I'd like
I am using the following sliding div script: http://www.webdesignerwall.com/demo/jquery/simple-slide-panel.html Currently, the slidetoggle function is
With a simple JQuery command, it will turn a regular button into something awesome.
The following simple jquery slider web page using CDNs for the CSS and javascript
I wrote a simple jQuery function to submit data from a textarea. The script
I have a simple jquery click event <script type="text/javascript"> $(function() { $('#post').click(function() { alert("test");
A simple jquery line of code: if ($j('#page2').length) { $j('#myPlaceHolder2').html('<button class=\button3\ type=\button\>Page II</button>'); }

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.