I've searched through stackoverflow as well as the rest of the web without finding a clear answer for what I am trying to do. I have the following HTML code:
<a id="orderPadReviewSubmitBtn" href="#" class="portlet-lightGrey-button float-right"><span>Submit order</span></a>
which is loaded via JavaScript from a button click. I am attempting to use delegate as the jQuery on the site is 1.4.2, so no "on()" is available.
The code I am trying is this:
$("a[id=orderPadReviewSubmitBtn]").delegate("span","load", function(){
$("#orderPadReviewSubmitBtn").mousedown(function(){alert("Order Submitted");}); });
I have also tried:
$("#orderPadReviewSubmitBtn").delegate("span","load", function(){
$("#orderPadReviewSubmitBtn").mousedown(function(){alert("Order Submitted");}); })
These work if loaded once the above button is loaded, but not if I run the jQuery before the button is loaded.
My ultimate goal is to be able to run some other function once this button loads and someone clicks on it.
I have a feeling that there is something simple I am missing, and your help in finding the issues would be greatly appreciated.