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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:14:29+00:00 2026-06-11T09:14:29+00:00

I admittedly don’t know much about JQuery but I have an AJAX form where

  • 0

I admittedly don’t know much about JQuery but I have an AJAX form where I need to trigger a click event when someone clicks the submit button, but because the button is not there initially, but on page three of the same form (The URL doesn’t change),I’m having issues using the click event.

In my code, I just want to run a function when a button is clicked.

<script type="text/javascript">
    //Run function when button is clicked

    $(document).ready(function () {
        $("#idOfButton").click(function () {
            doSomething();
        });
    });

    //The function I want ran when page visitor clicks button

    function doSomething() {
        //Do Something
    }
</script>

Obviously this code doesn’t work, but any suggestions on how to use .click? I’m only able to insert JS via a tag management system, so I can’t hard code anything into the page. Also, the JQuery version is 1.4, so I can’t use .on. Thanks for your help.

  • 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-11T09:14:30+00:00Added an answer on June 11, 2026 at 9:14 am

    Your code need to use the .on so that the event is bound when the button is available.. If you do not have the latest jQuery file available the you can use the .live instead.. Also you are saying that the button is not available on PageLoad.. So I created a small example of creating a button when a checkbox is checked.. After the button is created I am adding the event handler.. Chekc this

           <script type="text/javascript">
    
    
         <script type="text/javascript">
        //Run function when button is clicked
    
        $(document).ready(function () {
            $("#idOfButton").live('click', function () {
                doSomething();
            });
        });
    
        //The function I want ran when page visitor clicks button
    
        function doSomething() {
            //Do Something
        }
    </script>
    

    Check the FIDDLE here
    Also if you do not have the latest copy you can use the file hosted by google CDN .. You just need to include this file in your project..

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
    

    This will make sure you have the latest copy , and also reduces your site’s bandwidth..

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

Sidebar

Related Questions

This is an admittedly silly question, but I honestly don't know if this is
Chaining is great in jQuery, but it chains the trigger of each event and
Admittedly not a programming question, but I don't really know where else to ask
I am writing a Wordpress shortcodes plugin for a client and admittedly don't know
I don't know anything about the internals of the alternative JDK and seen as
Okay, Now admittedly this sounds like a silly question; But, I actually have a
Admittedly I don't get it. Say you have a memory with a memory word
It's the first time I'm trying to use typedef. Admittedly I don't have a
I admittedly am not very proficient with Javascript (and subsequently AJAX). I have a
I've seen so many implementations of sending an http post, and admittedly I don't

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.