You may use two options:
- createElement
- InnerHTML
Create Element is the fastest way (check here.):
$(document.createElement('table'));
InnerHTML is another popular approach:
$("#foo").append("hello world
"); // Check similar for table too.
Check a real example on How to create a new table with rows using jQuery and wrap it inside div.
There may be other approaches as well. Please use this as a starting point and not as a copy-paste solution.
Edit:
Check Dynamic creation of table with DOM
Edit 2:
IMHO, you are mixing object and inner HTML. Let's try with a pure inner html approach:
function createProviderFormFields(id, labelText, tooltip, regex) {
var tr = '' ;
// create a new textInputBox
var textInputBox = '';
// create a new Label Text
tr += '| ' + labelText + ' | ';
tr += '' + textInputBox + ' | ';
tr +='
';
return tr;
}