In this part of your code, you have a problem:
$("#tblCustomPattern").innerHTML;
The issue is that $("#tblCustomPattern")
is a jQuery object. It is not a DOM object. The jQuery object does not have a property .innerHTML
.
So, to fix your issue, you have several choices:
- You can get the DOM element out of the jQuery object and then use the
.innerHTML
property on the DOM object directly. - You can use the jQuery method for this same functionality by called the jQuery
.html()
method. - You don't even really need jQuery for this at all, so you can just use plain JS.
So, any of these will work:
// get the first DOM object from the jQuery object
// two different methods for doing that
var tblCustomPattern = $("#tblCustomPattern")[0].innerHTML;
var tblCustomPattern = $("#tblCustomPattern").get(0).innerHTML;
// use the jQuery method to get the HTML
var tblCustomPattern = $("#tblCustomPattern").html();
// use plain JS - fastest option
var tblCustomPattern = document.getElementById("tblCustomPattern").innerHTML;