I have created a function that has the capability to copy the specific data in each table cells but my problem is that it cannot be accessed after the page is loaded when I put it in $(window).load(function() {});
and if I also put it in $(document).ready(function () {});
, some of the table cells is not having the result I want. I'm able to solve my problem by creating the function in both window.load and document.ready but it's not what I want since it's a bit space consuming and not a good coding practice. How can I achieve a result somewhat like this.
$(document).ready(function () {
myCreatedFunction();
});
$(window).load(function() {
myCreatedFunction();
});
//and somewhere in the page in which can be accessed by both methods
var myCreatedFunction = function(){
//some other actions
}