There are 2 things you can do. Approach 1 would remove all click events from the button and add events, approach 2 would add additional events in addition to the existing event.
Approach 1
$('input:button').unbind('click'); // remove all click events associated
$('input:button').on("click",function() // add new click events
{
loadFinal();
applyCode();
});
Approach 2
$('input:button').on("click",function() // add additional click events
{
applyCode();
});
UPDATE :
In order to apply or append the applycode() event to the same element that has loadfinal(), you can use $._data to extract the events and check if a certain event exists or not.
$("input:button").click(function() {
var events = $._data(document.getElementById('btn1'), "events");
$.each(events,function(i,o)
{
alert(i);// give the event type like 'click'
alert(o); // give the event object - you can extract the event name from the object and do the compare with the existint event.
});
});
Alternately, you can directly target the click event.
var events = $._data(document.getElementById('btn1'), "events").click;
$.each(events,function(i,o)
{
alert(i);// give the index
alert(o); // give the event object - you can extract the event name from the object and do the compare with the existint event.
});
});
Implementation : http://jsfiddle.net/qk5qj33u/15/