I'm wondering if there's a way to use jquery $.data to bind button1 element to button2 so that when I click button2 I can access the button1 object and extract attributes etc.
The binding code I have is in the following function, this is called by clicking button1 and the this object is passed in as:
button1:
$(".acc-offer-clicked").click(function(e){
e.preventDefault();
getCourierList(this);
});
function getCourierList(obj) {
//Bind the accept button to the choose-courier button
$.data($("#choose_courier"), "accept", obj);
}
later when button1 is clicked I hope to extract button2 as
$("#choose_courier").click(function(e){
e.preventDefault();
var acceptbutton = $(this).data("accept");
});
At this point accept-button is undefined. I've been able to bind {} type objects before but I've never tried with an actual element. Is this even possible?