[Last Call] Learn how to a build a cloud-first strategyRegister Now


Find a javascript function

Posted on 2012-08-10
Medium Priority
Last Modified: 2012-08-26
I'm adding a javascript handler for some source code here:

Click Add Files, add a random image, click Start.

There's a lot of Javascript there but I cannot, for the life of me, find out where to add to the source code.

I've tried inspecting with Firebug.

Please show me where the action part of the javascript is, and tell me how you found it.
Question by:M256

Expert Comment

ID: 38282027
Try adding this code and putting what you ant to do inside the click event.  you should be able to add this to the first script file since it looks like you are including jQuery.

#Target being the id of the element you want to add the event to. You may need to ad an ID to the <span> Add Files...

     $("#target").click(function() {
              alert("Handler for .click() called.");

Open in new window


Author Comment

ID: 38282035
I think that would work for the Add Files button, but the Start button does not exist on document ready.
LVL 83

Accepted Solution

leakim971 earned 2000 total points
ID: 38282352
if the start button is not present at page load, you may use on or the old live :

$(".start").click(function() { alert("ok"); });
or (same as) :
$(".start").bind("click", function() { alert("ok"); });
or :
$(".start").live("click", function() { alert("ok"); });
or :
$("body").on("click", ".start", function() { alert("ok"); });

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses
Course of the Month18 days, 4 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question